Re: jsonb concatenate operator's semantics seem questionable

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Petr Jelinek <petr(at)2ndquadrant(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Ilya Ashchepkov <koctep(at)gmail(dot)com>
Subject: Re: jsonb concatenate operator's semantics seem questionable
Date: 2015-05-17 21:44:28
Message-ID: CAM3SWZQ1zr9jezcCZFp7Da6U_J=abyy_Rv1=TUgwQsnFDHN_tA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, May 17, 2015 at 7:16 AM, Petr Jelinek <petr(at)2ndquadrant(dot)com> wrote:
> Agreed, if you look at jquery for example, the extend() method by default
> behaves like our current || and you have to specify that you want deep merge
> if you want the behavior described by Peter. So there is definitely point
> for both, at this time we just support only one of them, that's all.

The difference is that with jquery's extend(), you can easily
subscript the JSON document you're extending so that you do so for the
right nested object (without merging any containers the target
contains, but rather overwriting them with any of the source's
containers -- makes sense when you're explicit about the nesting level
like that). With jsonb, however, we're usually stuck with having to
write an SQL expression that evaluates to the final jsonb document
that we want (for UPDATE targetlist assignment, typically).

This is an enormous difference. We still don't have a way to update a
nested object's single field that I can see, and nested objects are
absolutely commonplace for the "document database" use case. So I
don't accept that this is a matter of individual preference or taste.
It's a big, practical distinction.

--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-05-17 21:56:55 Re: jsonb concatenate operator's semantics seem questionable
Previous Message David G. Johnston 2015-05-17 21:36:20 Re: Problems with question marks in operators (JDBC, ECPG, ...)