Re: jsonb concatenate operator's semantics seem questionable

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: jsonb concatenate operator's semantics seem questionable
Дата
Msg-id 555A4744.9020208@agliodbs.com
обсуждение исходный текст
Ответ на jsonb concatenate operator's semantics seem questionable  (Peter Geoghegan <pg@heroku.com>)
Ответы Re: jsonb concatenate operator's semantics seem questionable  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
On 05/18/2015 01:04 PM, Ryan Pedela wrote:
> Let me back up a little. I always like to think about what is the ideal
> interface first and then worry about implementation because
> implementation can always be changed but interface can't. I think the
> current concat/merge interface is the ideal. It should be || because
> that means concat/merge everywhere else in the PG interface that I am
> aware of. In the case of JSON which is a hierarchically data structure,
> it should be implemented as a deep merge which by definition satisfies a
> shallow merge. This is what I would expect as a user and I would think
> there was a bug if it didn't perform deep merge. I expect this because I
> can implement shallow merge easily myself using Javascript, Python, etc
> but deep merge is non-trivial. Therefore I would expect a special JSON
> concat/merge library function to do deep merge. I would rather the
> interface stay the same and it documented that the current
> implementation is a shallow merge and may become a deep merge in the future.
> 
> In the context of splitting shallow and deep merge into two operators, I
> think + is better for shallow and || better for deep. The reason for +
> is because many programming languages have this behavior. If I see the
> below code in language I have never used before:
> 
> objC = objA + objB
> 
> My default assumption is that + performs a shallow merge. Like I said, I
> would rather there just be one operator.

Thank you, that helps.  Anyone else?

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ryan Pedela
Дата:
Сообщение: Re: jsonb concatenate operator's semantics seem questionable
Следующее
От: Marko Tiikkaja
Дата:
Сообщение: Re: jsonb concatenate operator's semantics seem questionable