Re: jsonb concatenate operator's semantics seem questionable - Mailing list pgsql-hackers

From Ryan Pedela
Subject Re: jsonb concatenate operator's semantics seem questionable
Date
Msg-id CACu89FT-w1TbU17V+TKGmRQdnLYRH=bWg1k8UoR8CU+-K0_c6g@mail.gmail.com
Whole thread Raw
In response to Re: jsonb concatenate operator's semantics seem questionable  (Josh Berkus <josh@agliodbs.com>)
Responses Re: jsonb concatenate operator's semantics seem questionable  (Ryan Pedela <rpedela@datalanche.com>)
List pgsql-hackers
On Sun, May 17, 2015 at 9:41 PM, Josh Berkus <josh@agliodbs.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: WIP: Enhanced ALTER OPERATOR
Next
From: Uriy Zhuravlev
Date:
Subject: Re: WIP: Enhanced ALTER OPERATOR