From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Petr Jelinek <petr(at)2ndquadrant(dot)com> |
Cc: | Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>, Josh Berkus <josh(at)agliodbs(dot)com>, Ryan Pedela <rpedela(at)datalanche(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Dmitry Dolgov <9erthalion6(at)gmail(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-20 06:11:47 |
Message-ID: | CAM3SWZQVMmyqjZ=Vs6B7VXYrhFd1VomPf0d3KH2Vr8x7yD=WMA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, May 19, 2015 at 10:43 PM, Petr Jelinek <petr(at)2ndquadrant(dot)com> wrote:
> I am of strong opinion that concat should be shallow by default. Again it's
> how jquery works by default, it's how python's dict.update works and you can
> find this behavior in other languages as well when dealing with nested
> hashes. It's also how json would behave if you'd just did string
> concatenation (removing the outermost curly brackets) and parse it to json
> afterwards.
As I said, that argument might be a good one if you were able to
subscript jsonb and have the update affect one particular subdocument.
You're not, though -- updating jsonb usually requires you to write an
SQL expression that evaluates to the final jsonb document that you'd
like to update a record to contain.
> I think this whole discussion shows primarily that it's by far not
> universally agreed if concatenation of json should be shallow or deep by
> default and AFAICS this is true even in javascript world so we don't really
> have where to look for precedents.
>
> Given the above I would vote to just provide the function and leave out the
> || operator for now.
I've said my piece; I think it's a mistake to use an operator that has
a certain association, the association that the concatenate operate
got from hstore. || is the operator broadly useful for updates in
people's minds. I think this *positioning* of the operator is a
mistake. I'll leave it at that.
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2015-05-20 06:45:19 | Re: Rewriting backup.sgml (patch attached) |
Previous Message | Peter Geoghegan | 2015-05-20 05:50:54 | Re: Minor ON CONFLICT related fixes |