Re: jsonb concatenate operator's semantics seem questionable

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Ryan Pedela <rpedela(at)datalanche(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 18:24:01
Message-ID: 555A2E41.8020607@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/17/2015 09:11 PM, Peter Geoghegan wrote:> As I said, I don't think
that my preference for deep concatenation is
> a matter of taste. I think that shallow concatenation is fundamentally
> and objectively at odds with what jsonb is supposed to be (as long as
> concatenation is the way "nested assignment" works, which is what
> users have been taught to think).

That was a really wordy way to not answer my question. Everyone wants
deep append. We don't have it. Unless you have a finished, tested
patch you're sitting on, that discussion isn't relevant with the sole
exception of whether we want to reserve "||" for it.

On 05/18/2015 08:57 AM, Ryan Pedela wrote:
> If not, deep concatenation would solve this problem, but I can also see
> another solution. Use + for shallow concatenation since it really means
> "add element to top-level path" as Peter suggests. Then add another
> function: jsonb_add( target jsonb, path text[], new jsonb ) to add
> element at any arbitrary path. Then leave || for deep concatenation in
> 9.6 or whenever.

Since swapping the operator seems still on the table, is there any
particular reason why you think "+" is more suited to shallow
concatination? Both you and Peter have said this, but as a heavy user
of JSON/JSONB, to me it seems the other way around. That is, "+" says
"add to arbitrary nested node" to me more than "||" does.

> If jsonb_replace() satisfies #4 then I think everything is fine. Without
> #4 however, jsonb would remain an incomplete document database solution
> in my opinion.

Oh, no question, we're still incomplete. Aside from nested append, we
kinda lack easy sharded scale-out, which is a rather more major feature, no?

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2015-05-18 18:25:24 Re: Disabling trust/ident authentication configure option
Previous Message Andrew Dunstan 2015-05-18 18:16:23 Re: jsonb concatenate operator's semantics seem questionable