On 1/15/16, Glyn Astill <glynastill@yahoo.co.uk> wrote:
> Hi all,
>
> I was just looking through the new jsonb operators in the 9.5 release, and
> was wondering if there's any future intention to add a delete operator that
> removes element/pair matches? I.e. some sort of top-level "jsonb - jsonb"
> operator, e.g.
>
>
> # select '{"a":1, "b":2}'::jsonb - '{"b":2, "a":4}'::jsonb;
> ?column?
> ----------
> {"a": 1}
> (1 row)
>
> Or would this behaviour be classed as incorrect in some way?
>
> Thanks
> Glyn
I thing the operator 'jsonb-jsonb' behavior in such case is not obvious.
How to understand the result is not like that:
# select '{"a":1, "b":2}'::jsonb - '{"b":2, "a":4}'::jsonb;
?column?
----------
{"a": -3, "b": 0}
(1 row)
P.S.: I guess an _operator_ jsonb+jsonb doesn't exist by the same way…
--
Best regards,
Vitaly Burovoy