Re: jsonb - jsonb operators - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: jsonb - jsonb operators
Date
Msg-id CAHyXU0zphQhAz__b+yGQCfQSZ2CAB_=wSyzdh109fNeHoq-fQA@mail.gmail.com
Whole thread Raw
In response to jsonb - jsonb operators  (Glyn Astill <glynastill@yahoo.co.uk>)
Responses Re: jsonb - jsonb operators  (Glyn Astill <glynastill@yahoo.co.uk>)
List pgsql-hackers
On Fri, Jan 15, 2016 at 7:43 AM, 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
intentionto 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?

It makes sense for simple json objects in your contrived example.

How would you define complex structures?  What happens when the key
matches but not the value?

merlin



pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Limit and inherited tables
Next
From: Fabien COELHO
Date:
Subject: Re: extend pgbench expressions with functions