JSON merge in postgresql - Mailing list pgsql-general

From Arup Rakshit
Subject JSON merge in postgresql
Date
Msg-id 2074711.SjZpPot3r7@linux-wzza.aruprakshit
Whole thread Raw
List pgsql-general
I have a simple table having column `data` which is a JSON type. Sample data I took from --
http://schinckel.net/2014/05/25/querying-json-in-postgres/

[arup@pg_food_mgmt (master)]$ rails db
psql (9.2.7)
Type "help" for help.

pg_foo_development=# SELECT * FROM json_test;
 id |                 data
----+--------------------------------------
  1 | {}
  2 | {"a": 1}
  3 | {"a": 2, "b": ["c", "d"]}
  4 | {"a": 1, "b": {"c": "d", "e": true}}
  5 | {"b": 2}
(5 rows)

Now suppose I want to update the record#1 and # 2 as {"a": 12} and {"a": 2, "b": ["c", "d"]} .. What is the way to
updatethis ? 

--
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as
possible,you are, by definition, not smart enough to debug it. 

--Brian Kernighan


pgsql-general by date:

Previous
From: Jerry Sievers
Date:
Subject: Re: check data for datatype
Next
From: Eli Murray
Date:
Subject: Re: Building JSON objects