From: | david(dot)turon(at)linuxbox(dot)cz |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: JSONB - JSONB operator feature request |
Date: | 2017-07-19 11:00:54 |
Message-ID: | OF7F632F73.106246AF-ONC1258162.003C004F-C1258162.003C823D@notes.linuxbox.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)linuxbox(dot)cz
-------------------------------------
Od: David Fetter <david(at)fetter(dot)org>
Komu: david(dot)turon(at)linuxbox(dot)cz
Kopie: pgsql-hackers(at)postgresql(dot)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(dot)turon(at)linuxbox(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Rofail | 2017-07-19 11:56:19 | Re: GSoC 2017: Foreign Key Arrays |
Previous Message | Etsuro Fujita | 2017-07-19 10:21:04 | Re: Bug in ExecModifyTable function and trigger issues for foreign tables |