Re: jsonb - jsonb operators

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Glyn Astill <glynastill(at)yahoo(dot)co(dot)uk>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb - jsonb operators
Date: 2016-01-15 14:50:50
Message-ID: CAHyXU0zphQhAz__b+yGQCfQSZ2CAB_=wSyzdh109fNeHoq-fQA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 15, 2016 at 7:43 AM, Glyn Astill <glynastill(at)yahoo(dot)co(dot)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?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-01-15 14:53:59 Re: extend pgbench expressions with functions
Previous Message Konstantin Knizhnik 2016-01-15 14:49:37 Limit and inherited tables