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

From Peter Geoghegan
Subject Re: jsonb concatenate operator's semantics seem questionable
Date
Msg-id CAM3SWZTLO10FgDac7vAJZQVyKedWia1qrEtgcm-tR-JP+eYMnQ@mail.gmail.com
Whole thread Raw
In response to Re: jsonb concatenate operator's semantics seem questionable  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: jsonb concatenate operator's semantics seem questionable
List pgsql-hackers
On Sun, May 17, 2015 at 3:22 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
> So what exactly do you want me or anybody else to do now, two days *after*
> we declared (not without pain) feature freeze?

As much as I'd like to just fix the concatenate operator, I really
don't want to be the person that adds additional delay to stabilizing
9.5.

> If there is a consensus that what you want is so important that we need to
> implement the new behaviour at this late stage, I'm happy to spend time on
> it if there's a patch forthcoming. I might add that this should be an
> additional behaviour, since as Petr points out there is some validity to the
> current behviour.

The current behavior does not seem acceptable for the concatenate
operator ("operator || jsonb"). If we can't fix it as the concatenate
operator, I think we should change it to be "operator + jsonb" or
something. It should be explained and understood as an operator that
(like the original existence operator "operator ? text", but unlike
the original containment operator "operator @> jsonb") exists only to
support the less common hstore-style use case. It should also not be
referred to as offering concatenation, but something more specialized
than that. I'm sorry, but as things stand I don't think that the
concatenation behavior makes sense as the general purpose jsonb
concatenate operator.

I'll go with the consensus, but obviously I feel pretty strongly that
we have the behavior of "operator || jsonb" wrong. We should at the
very least work towards a future version where there is a "operator ||
jsonb" that does the right thing. I don't even like the idea of having
this as an "operator + jsonb" operator, though, because it introduces
an operator that is concerned with the hstore-style use case that I
described before, and yet accepts a jsonb datum on the rhs.

Again, I'm sorry that I brought this up late, and I hope that this
doesn't seem capricious. I just happen to sincerely feel that the
current state of "operator || jsonb" leads us in the wrong long-term
direction. Let's hear what other people think, though.

-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: jsonb concatenate operator's semantics seem questionable
Next
From: Robert Haas
Date:
Subject: Re: WALWriteLock contention