pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Floris Van Nee <florisvannee@optiver.com>
Cc: Ariadne Conill <ariadne@dereferenced.org>
Cc: Mark Felder <feld@freebsd.org>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: jsonb_set() strictness considered harmful to data
Date: Fri, 15 Nov 2019 15:01:19 -0500
Message-ID: <a0dab101-7645-b011-888f-7323202f3b6f@2ndQuadrant.com> (raw)
In-Reply-To: <CAFj8pRCKv50=DYzhPAbEiqrt3cnXRg9HccFdtxmghJUMyQPs0g@mail.gmail.com>
References: <CAKFQuwa0epfqMsJ=yz8t+ASmdf5PoFXhXj=9DBpoHa2i_67nJw@mail.gmail.com>
	<a2c965cc-7d90-ed89-d50f-b2c046d4499e@2ndQuadrant.com>
	<20191019192723.luarxhq57qkzuncw@development>
	<CAAOiGNxmXSUdOzBg+7vWMzTjDELmiZi_dqGz355tKy+OgbCZpA@mail.gmail.com>
	<1571560798575.47024@Optiver.com>
	<34a7ff88-0d86-0990-4eac-48159df8d7f2@2ndQuadrant.com>
	<CAKFQuwbkKPYhT0S6481L7temmiN+VNrMkExsUjp6FjJnCynd5A@mail.gmail.com>
	<5db07acf-bc75-edf8-60af-905c0adadb68@2ndQuadrant.com>
	<20191020201839.olpuyuzixagcvvud@development>
	<5b8a26bf-6b46-71f3-a99e-3fb9a8095232@2ndQuadrant.com>
	<20191021060701.or6a6a7lg3asixom@development>
	<544ecc1e-681e-69f1-5cde-8b8aaeb45d7f@2ndQuadrant.com>
	<375873e2-c957-3a8d-64f9-26c43c2b16e7@2ndQuadrant.com>
	<CAFj8pRCKv50=DYzhPAbEiqrt3cnXRg9HccFdtxmghJUMyQPs0g@mail.gmail.com>


On 11/15/19 2:14 PM, Pavel Stehule wrote:
> Hi
>
>
>
>     For release 13+, I have given some more thought to what should be
>     done.
>     I think the bar for altering the behaviour of a function should be
>     rather higher than we have in the present case, and the longer the
>     function has been sanctioned by time the higher the bar should be.
>     However, I think there is a case to be made for providing a non-strict
>     jsonb_set type function. To advance th4e discussion, attached is a POC
>     patch that does that. This can also be done as an extension, meaning
>     that users of back branches could deploy it immediately. I've tested
>     this against release 12, but I think it could go probably all the way
>     back to 9.5. The new function is named jsonb_ set_lax, but I'm open to
>     bikeshedding.
>
>
> I am sending a review of this patch
>
> 1. this patch does what was proposed and it is based on discussion.
>
> 2. there are not any problem with patching or compilation, all regress
> tests passed.
>
> 4. code looks well and it is well commented.
>
> 5. the patch has enough regress tests
>
> My notes:
>
> a) missing documentation
>
> b) error message is not finalized
>
> +       ereport(ERROR,
> +               (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
> +                errmsg("null jsonb value")));
>
> Any other looks well, and this function can be very handy.
>
>

Thanks for the review. I will add some docco.


What would be a better error message? "null jsonb replacement not
permitted"?


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: <a0dab101-7645-b011-888f-7323202f3b6f@2ndQuadrant.com>
Permalink:  ../a0dab101-7645-b011-888f-7323202f3b6f@2ndQuadrant.com/
Also on:    postgresql.org/message-id/a0dab101-7645-b011-888f-7323202f3b6f@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, pavel.stehule@gmail.com, tomas.vondra@2ndquadrant.com, david.g.johnston@gmail.com, florisvannee@optiver.com, ariadne@dereferenced.org, feld@freebsd.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: jsonb_set() strictness considered harmful to data
  In-Reply-To: <a0dab101-7645-b011-888f-7323202f3b6f@2ndQuadrant.com>
  References: <CAKFQuwa0epfqMsJ=yz8t+ASmdf5PoFXhXj=9DBpoHa2i_67nJw@mail.gmail.com> <a2c965cc-7d90-ed89-d50f-b2c046d4499e@2ndQuadrant.com> <20191019192723.luarxhq57qkzuncw@development> <CAAOiGNxmXSUdOzBg+7vWMzTjDELmiZi_dqGz355tKy+OgbCZpA@mail.gmail.com> <1571560798575.47024@Optiver.com> <34a7ff88-0d86-0990-4eac-48159df8d7f2@2ndQuadrant.com> <CAKFQuwbkKPYhT0S6481L7temmiN+VNrMkExsUjp6FjJnCynd5A@mail.gmail.com> <5db07acf-bc75-edf8-60af-905c0adadb68@2ndQuadrant.com> <20191020201839.olpuyuzixagcvvud@development> <5b8a26bf-6b46-71f3-a99e-3fb9a8095232@2ndQuadrant.com> <20191021060701.or6a6a7lg3asixom@development> <544ecc1e-681e-69f1-5cde-8b8aaeb45d7f@2ndQuadrant.com> <375873e2-c957-3a8d-64f9-26c43c2b16e7@2ndQuadrant.com> <CAFj8pRCKv50=DYzhPAbEiqrt3cnXRg9HccFdtxmghJUMyQPs0g@mail.gmail.com> <a0dab101-7645-b011-888f-7323202f3b6f@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