Re: [PATH] Jsonb, insert a new value into an array at arbitrary position
| От | Tom Lane |
|---|---|
| Тема | Re: [PATH] Jsonb, insert a new value into an array at arbitrary position |
| Дата | |
| Msg-id | 8081.1459883293@sss.pgh.pa.us обсуждение |
| Ответ на | Re: [PATH] Jsonb, insert a new value into an array at arbitrary position (Andrew Dunstan <andrew@dunslane.net>) |
| Ответы |
Re: [PATH] Jsonb, insert a new value into an array at
arbitrary position
|
| Список | pgsql-hackers |
Andrew Dunstan <andrew@dunslane.net> writes:
> On 04/05/2016 12:42 PM, Teodor Sigaev wrote:
>> I'm agree about covering this case by tests, but I think it should be
>> allowed.
>> In this case it will work exactly as jsbonb_set
> It seems to me a violation of POLA to allow something called "insert" to
> do a "replace" instead.
I agree with Andrew's point here. If the target is an array it would
never replace an entry, so why would it do so for an object?
I think there is potentially some use-case for insert-only semantics
for an object target, if you want to be sure you're not overwriting
data. So I think "throw an error on duplicate key" is marginally better
than "reject object target altogether". But I could live with either.
regards, tom lane
В списке pgsql-hackers по дате отправления: