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