Re: jsonb concatenate operator's semantics seem questionable

From: Ryan Pedela <rpedela(at)datalanche(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, 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-18 14:41:39
Message-ID: CACu89FT-w1TbU17V+TKGmRQdnLYRH=bWg1k8UoR8CU+-K0_c6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, May 17, 2015 at 9:41 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:

> Is there a particular reason why "+" makes more sense as "shallow
> concatination" and "||" makes more sense as "deep concatination"? Like,
> something in JS or other client languages which would make that
> preference make more sense to users?
>

As someone who uses JSON day-to-day in Javascript and Python, I personally
don't think || or + matters much. Python uses json.loads() for JSON concat
and you have use a 3rd-party library in Javascript if you want that
functionality such as JQuery.extends(). I agree with Peter that we need
deep concatenation, but I don't think there is any standard for the
operator. I think the word "shallow" should be added to the docs though.

What is far more important than shallow or deep concatenation for the
document database use case is being able to delete or replace/update a
specific, nested path in the JSON object. It looks like that is possible
with the minus operator and jsonb_replace(). This is great, however it took
me awhile to figure out the path syntax. I think adding a paragraph to the
docs explaining the path syntax would help.

Ryan Pedela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Uriy Zhuravlev 2015-05-18 14:44:16 Re: WIP: Enhanced ALTER OPERATOR
Previous Message Tom Lane 2015-05-18 14:21:10 Re: WIP: Enhanced ALTER OPERATOR