Re: [HACKERS] JSONB - JSONB operator feature request

Поиск
Список
Период
Сортировка
От david.turon@linuxbox.cz
Тема Re: [HACKERS] JSONB - JSONB operator feature request
Дата
Msg-id OF7F632F73.106246AF-ONC1258162.003C004F-C1258162.003C823D@notes.linuxbox.cz
обсуждение исходный текст
Ответ на Re: [HACKERS] JSONB - JSONB operator feature request  (David Fetter <david@fetter.org>)
Список pgsql-hackers
Hi,

hstore have only key-value pairs, but in json can have same behavior - only equal objects are removed:

SELECT '{"a": 1, "b": {"c": 2}}'::JSONB - '{"a": 1, "b": {"c": 3}}'::JSONB
'{"b": {"c": 2}}'

SELECT '{"a": 1, "b": {"c": 2}}'::JSONB - '{"a": 2, "b": {"c": 2}}'::JSONB
'{"a": 1}'

David


--
-------------------------------------
Ing. David TUROŇ
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava

tel.:    +420 591 166 224
fax:    +420 596 621 273
mobil:  +420 732 589 152
www.linuxbox.cz

mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz
-------------------------------------




Od:        David Fetter <david@fetter.org>
Komu:        david.turon@linuxbox.cz
Kopie:        pgsql-hackers@postgresql.org
Datum:        18. 07. 2017 18:24
Předmět:        Re: [HACKERS] JSONB - JSONB operator feature request




On Tue, Jul 18, 2017 at 01:36:32PM +0200, david.turon@linuxbox.cz wrote:
> Hi,
>
> some users and me used hstore - hstore for example storing only changed
> rows in trigger like:
>
> hstore(NEW) - hstore(OLD)
>
> There isn't same operator/function in JSON/JSONB. We can only remove keys
> from JSONB, but not equal key-value pairs. Is there any chance to have
> same feature with JSON/JSONB in postgres core?

What would - mean precisely for JSON[B]?

For example, what would you expect

SELECT '{"a": 1, "b": {"c": 2}}'::JSONB - '{"b": 1, "b": {"c": 3}}'::JSONB

to yield?

Best,
David.
--
David Fetter <david(at)fetter(dot)org>
http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres:
http://www.postgresql.org/about/donate


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Etsuro Fujita
Дата:
Сообщение: Re: [HACKERS] Bug in ExecModifyTable function and trigger issues forforeign tables
Следующее
От: Mark Rofail
Дата:
Сообщение: Re: [HACKERS] GSoC 2017: Foreign Key Arrays