pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Mark Felder <feld@FreeBSD.org>
Cc: pgsql-general@lists.postgresql.org
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: jsonb_set() strictness considered harmful to data
Date: Sat, 19 Oct 2019 12:32:10 -0400
Message-ID: <11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com> (raw)
In-Reply-To: <20191019161851.v7dwloiiav5yrpwu@development>
References: <CAAOiGNwUsgM-UBqsJH_mriCFr-JCPxD+pQoXNvyOEQPc+YHQRQ@mail.gmail.com>
	<d7a4e2b2-e009-4d79-aa5b-82bcf96aad2f@www.fastmail.com>
	<7dc242bd-b78f-2e0d-0c38-7b4b299f11bf@2ndQuadrant.com>
	<20191019161851.v7dwloiiav5yrpwu@development>


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






view thread (83+ messages)  latest in thread

Message-ID: <11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com>
Permalink:  ../11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com/
Also on:    postgresql.org/message-id/11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andrew.dunstan@2ndquadrant.com, tomas.vondra@2ndquadrant.com, feld@FreeBSD.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: jsonb_set() strictness considered harmful to data
  In-Reply-To: <11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com>
  References: <CAAOiGNwUsgM-UBqsJH_mriCFr-JCPxD+pQoXNvyOEQPc+YHQRQ@mail.gmail.com> <d7a4e2b2-e009-4d79-aa5b-82bcf96aad2f@www.fastmail.com> <7dc242bd-b78f-2e0d-0c38-7b4b299f11bf@2ndQuadrant.com> <20191019161851.v7dwloiiav5yrpwu@development> <11b0453d-65d0-c9dc-ce8d-a33665f672c1@2ndQuadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox