Paste this into a new question or an answer at dba.stackexchange.com:
<!-- --> > CREATE TABLE test_hstore AS > SELECT '1'::int AS id, NULL::hstore AS map; -- table with 1 row > > <pre> 1 rows affected > </pre> <!-- --> > TABLE test_hstore; > > <pre> > id | map > -: | :--- > 1 | <em>null</em> > </pre> <!-- --> > UPDATE test_hstore SET map = map || hstore('key1', 'value1') > RETURNING *; > > <pre> > id | map > -: | :--- > 1 | <em>null</em> > </pre> <!-- --> > UPDATE test_hstore SET map = COALESCE(map, '') || hstore('key1', 'value1') > RETURNING *; > > <pre> > id | map > -: | :--------------- > 1 | &quot;key1&quot;=&gt;&quot;value1&quot; > </pre> *db<>fiddle [here](https://dbfiddle.uk/?rdbms=postgres_12&fiddle=6652d46478c5bd8b6f9c5e2def2e9e5c)*
back to fiddle