Re: jsonb concatenate operator's semantics seem questionable
От | Peter Geoghegan |
---|---|
Тема | Re: jsonb concatenate operator's semantics seem questionable |
Дата | |
Msg-id | CAM3SWZQVMmyqjZ=Vs6B7VXYrhFd1VomPf0d3KH2Vr8x7yD=WMA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: jsonb concatenate operator's semantics seem questionable (Petr Jelinek <petr@2ndquadrant.com>) |
Ответы |
Re: jsonb concatenate operator's semantics seem questionable
|
Список | pgsql-hackers |
On Tue, May 19, 2015 at 10:43 PM, Petr Jelinek <petr@2ndquadrant.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
В списке pgsql-hackers по дате отправления: