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