Re: jsonb_set() strictness considered harmful to data - Mailing list pgsql-general

From Andrew Dunstan
Subject Re: jsonb_set() strictness considered harmful to data
Date
Msg-id 11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com
Whole thread Raw
In response to Re: jsonb_set() strictness considered harmful to data  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-general
On 10/19/19 12:18 PM, Tomas Vondra wrote:
> On Sat, Oct 19, 2019 at 11:26:50AM -0400, Andrew Dunstan wrote:
>
> Not sure, but that seems rather confusing to me, because it's mixing SQL
> NULL and JSON null, i.e. it's not clear to me why
>
>    jsonb_set(..., "...", NULL)
>
> should do the same thing as
>
>    jsonb_set(..., "...", 'null':jsonb)
>
> I'm not entirely surprised it's what MySQL does ;-) but I'd say treating
> it as a deletion of the key (just like MSSQL) is somewhat more sensible.
> But I admit it's quite subjective.
>


That's yet another variant, which just reinforces my view that there is
no guaranteed-intuitive behaviour here.


OTOH, to me, turning jsonb_set into jsonb_delete for some case seems ...
odd.


cheers


andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




pgsql-general by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: jsonb_set() strictness considered harmful to data
Next
From: "David G. Johnston"
Date:
Subject: Re: jsonb_set() strictness considered harmful to data