Re: jsonb concatenate operator's semantics seem questionable

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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 12:05:03
Message-ID: 5559D56F.9030601@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 05/18/2015 12:11 AM, Peter Geoghegan wrote:
> On Sun, May 17, 2015 at 8: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?
>>
>> While I hate last-minute changes in general, once we have this
>> functionality as || we won't be able to swap operators later if we
>> decide that deep concatination should have been ||. So I want to be
>> clear on why users will prefer that to + .
> This guy is talking about the concatenation operator in hstore:
> https://twitter.com/toolmantim/status/589348855302344705
>
> I don't want to present this operator as being the equivalent for
> jsonb (the thing you use for assignment). I wish it was, but it just
> isn't, as long as it treats the first nesting level as special. jsonb
> is all about nesting in general, and its concatenate operator must
> reflect this. It wouldn't be much use if "operator @> jsonb" didn't
> care about nesting either, but it does (unlike hstore's equivalent,
> because hstore doesn't nest).
>
> I don't think that (say) an "operator + jsonb" ought to be called a
> concatenation operator at all. The idea is to distance what we have
> here from the idea of an hstore concatenate operator, and to encourage
> the understanding that it has only a specialized use. I think that the
> danger of someone making the wrong assumption about the new "operator
> || jsonb" is very real (I think that the reverse wouldn't be true,
> though, if concatenation worked in a nested fashion -- that wouldn't
> bother users that had non-nested jsonb documents).
>
> 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).

I'm not going to react to a Twitter conversation. I honestly think you
are massively overstating your case here. And forget about hstore. It's
really not relevant here. This code had its origin in NESTED hstore,
which we don't have, but it's flown the nest.

Once again, nobody is arguing against deep of recursive concatenation,
so you're really arguing against a straw man. It just happens to be
what we don't have.

As between || and + I'm personally moderately indifferent. I think
you're representing some body of understanding about the effects of
certain operators as being widespread when that's very far from clear.

You really still haven't said what you want us to do. Mostly you have
expressed your unhappiness without suggesting a path forward. That's not
helpful.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2015-05-18 12:15:22 Re: trust authentication behavior
Previous Message Oskari Saarenmaa 2015-05-18 11:56:58 Re: jsonb concatenate operator's semantics seem questionable