JSON merge in postgresql

Поиск
Список
Период
Сортировка
От Arup Rakshit
Тема JSON merge in postgresql
Дата
Msg-id 2074711.SjZpPot3r7@linux-wzza.aruprakshit
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Jerry Sievers
Дата:
Сообщение: Re: check data for datatype
Следующее
От: Eli Murray
Дата:
Сообщение: Re: Building JSON objects