Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLqXt-0001pH-75 for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2019 15:21:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLqXr-0006S0-JI for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2019 15:21:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLqXr-0006Pu-9E for pgsql-general@lists.postgresql.org; Sat, 19 Oct 2019 15:21:31 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLqXn-0006Md-S8 for pgsql-general@lists.postgresql.org; Sat, 19 Oct 2019 15:21:30 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 2B52B5F79F; Sat, 19 Oct 2019 11:21:26 -0400 (EDT) Date: Sat, 19 Oct 2019 11:21:26 -0400 From: Stephen Frost To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: Tomas Vondra , Ariadne Conill , Adrian Klaver , "David G. Johnston" , Christoph Moench-Tegeder , "pgsql-generallists.postgresql.org" , feld@freebsd.org Subject: Re: jsonb_set() strictness considered harmful to data Message-ID: <20191019152125.GN6962@tamriel.snowman.net> References: <20191018215018.GB56427@elch.exwg.net> <20191018235159.GG6962@tamriel.snowman.net> <20191019110831.7y7d2yys5xlujqw6@development> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1rUnDtnJ1y3KAW/6" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --1rUnDtnJ1y3KAW/6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Dmitry Dolgov (9erthalion6@gmail.com) wrote: > If we want to change it, the question is where to stop? Essentially we ha= ve: >=20 > update table set data =3D some_func(data, some_args_with_null); >=20 > where some_func happened to be jsonb_set, but could be any strict functio= n. I don't think it makes any sense to try and extrapolate this out to other strict functions. Functions should be strict when it makes sense for them to be- in this case, it sounds like it doesn't really make sense for jsonb_set to be strict, and that's where we stop it. > I wonder if in this case it makes sense to think about an alternative? For > example, there is generic type subscripting patch, that allows to update a > jsonb in the following way: >=20 > update table set jsonb_data[key] =3D 'value'; >=20 > It doesn't look like a function, so it's not a big deal if it will handle= NULL > values differently. And at the same time one can argue, that people, who = are > not aware about this caveat with jsonb_set and NULL values, will most lik= ely > use it due to a bit simpler syntax (more similar to some popular programm= ing > languages). This seems like an entirely independent thing ... Thanks, Stephen --1rUnDtnJ1y3KAW/6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJdqyn1AAoJEO1sijiDR2RVlaAP/iBjZ1qFxW3i+Lb62Yih01UZ gw8Eqa6/ie665y938FunJvzwDqs8jJV7KY+FFm3UhTfb/4x7Q/btlxTfYkpIyvut GCjWPGIy9FxkDxOqp98VN+rVlJaH6yNa3dScC1bFiQaVfZl9jJgtRqu3xaj2jU4S 6/6MoyNN04iftVjVqKbb/LWNxx3WRTuuCZ9bfmolZNg0pskD778TvSQZGlR2GKC4 r5pzZGIc9XBkTXRJNbVWmOpDxBy7zkocrDVO2WR7GL7Y02y3S7ZOUaxCP3XqlU8O Nt29k9yZhQmFZdjxs84Ee8LvckpuQGoL5vZpkMcU4p9gOxyhMUs5WeKmMp805ARn F5ruvp4pw70asLHKuq+op6T+Lwycu7Oo4O0KnPu/RA2stk1hwhCsfYs4+Jfbu8fp j6+BNePawodPyeOT2z8SBoKG3xjpwluYsQf+pER5q486dIwZw6HY+cqFN+Ukut8O WbohKJR/Rd9Vamu7I2H2Go0Z8FkVzwi12mJfpG02dZQLQkRHC4alLb3cAOwv5T6O vnJjWuvzFgEFU3UIvQSQhZopO7kGgCC2ig64n2xYMSuJIZakBHWaEjTb2niUlpkA f6zTCDp18qKQWShBdvMb7NOzOizVtxVVkIvXHOrDxJViOJXqlq+1pnTEwPrZa8Cc Q5vaRVUP/vxkDM5UkVs7 =f+RS -----END PGP SIGNATURE----- --1rUnDtnJ1y3KAW/6--