Sample Header Ad - 728x90

updating a hstore with multiple new columns

2 votes
1 answer
3154 views
I am trying to add 2 new hstore key/value pairs in my postgreSQL database. Is it possible to do this in one statement or do I need to break it up? Here is what I have so far and it is not working. with foo as ( select id, new_value_1, new_value_2 from table 3 ) update public.table1 set hstore = hstore('new_key_1',foo.new_value_1), hstore = hstore('new_key_2',foo.new_value_2) where id = foo.id I am getting a error where I cannot call the same row in a update twice in a row. How would can i insert into the hstore two different values I am selecting in the foo statement above as values with a new key into a hstore of columns that already exist. I just need to tag the rows so even if the values change the original values are stored for future issue resolution.
Asked by Kyle K (187 rep)
Mar 7, 2017, 03:34 PM
Last activity: Mar 7, 2017, 04:21 PM