From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Teodor Sigaev <teodor(at)sigaev(dot)ru>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com> |
Cc: | David Steele <david(at)pgmasters(dot)net>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATH] Jsonb, insert a new value into an array at arbitrary position |
Date: | 2016-04-05 17:09:26 |
Message-ID: | 5703F146.4010102@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 04/05/2016 12:42 PM, Teodor Sigaev wrote:
>> I've been asked to look at and comment on the SQL API of the feature.
>> I think
>> it's basically sound, although there is one thing that's not clear
>> from the
>> regression tests: what happens if we're inserting into an object and
>> the key
>> already exists? e.g.:
>>
>> select jsonb_insert('{"a": {"b": "value"}}', '{a, b}', '"new_value"');
>>
>> I think this should be forbidden, i.e. the function shouldn't ever
>> overwrite an
>> existing value. If that's not handled it should be, and either way
>> there should
>> be a regression test for it.
>
> 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.
cheers
andre
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2016-04-05 17:10:11 | Re: LOCK TABLE .. DEFERRABLE |
Previous Message | Peter Geoghegan | 2016-04-05 17:05:41 | Re: Relation extension scalability |