How to increment value in postgres update statement on JSON key
问题 When updating a relational table: CREATE TABLE foo ( id serial primary key, credit numeric); UPDATE foo SET bar = bar + $1 WHERE id = $2; However the equivalent in JSON doesn't work: CREATE TABLE foo ( id serial primary key, data json); UPDATE foo SET data->'bar' = data->'bar' + $1 WHERE id = $2; The error I get is error: syntax error at or near "->" - which is rather ambiguous. How do I do this? I am using postgres 9.3.4 In light of @GordonLinoff's comment below, I have created a feature