From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Teodor Sigaev <teodor(at)sigaev(dot)ru>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Vitaly Burovoy <vitaly(dot)burovoy(at)gmail(dot)com>, 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 19:08:13 |
Message-ID: | 8081.1459883293@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Andrew Dunstan <andrew(at)dunslane(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2016-04-05 19:08:37 | Re: pgbench more operators & functions |
Previous Message | Tom Lane | 2016-04-05 19:00:02 | Re: Endless loop calling PL/Python set returning functions |