I have a hstore column that has “foo”=>”bar”. I want to add a second key, foo2, with the same value as foo.
Here’s what I’ve tried:
UPDATE mytable
SET mycol = mycol || concat('"foo2"=>"', mycol->'foo', '"')::hstore
WHERE mycol->'foo' IS NOT null
This works for some rows but on others I get the strange error
ERROR: Syntax error near “?” at position 139
What’s the best way to do this?