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 1i8Q91-0004Ej-2C for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Sep 2019 14:32:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i8Q8z-00081W-W4 for pgsql-bugs@arkaria.postgresql.org; Thu, 12 Sep 2019 14:32:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8Q8l-0005Pz-IR for pgsql-bugs@lists.postgresql.org; Thu, 12 Sep 2019 14:32:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1i8Q8j-0005l1-1N for pgsql-bugs@lists.postgresql.org; Thu, 12 Sep 2019 14:32:06 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8CEW0QY019279; Thu, 12 Sep 2019 10:32:00 -0400 From: Tom Lane To: Thomas Kellerer cc: =?UTF-8?B?0JzQsNGA0Lo=?= , pgsql-bugs@lists.postgresql.org Subject: Re: Unexpected behavior of jsonb_set() with a `null` value In-reply-to: References: Comments: In-reply-to Thomas Kellerer message dated "Thu, 12 Sep 2019 16:11:52 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <19277.1568298720.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 12 Sep 2019 10:32:00 -0400 Message-ID: <19278.1568298720@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Kellerer writes: > =D0=9C=D0=B0=D1=80=D0=BA schrieb am 12.09.2019 um 12:55: >> The expected behavior is, perhaps, to convert an SQL `NULL` value to JS= ONB null value: 'null'::jsonb > I have asked the same: https://www.postgresql.org/message-id/flat/qfkua9= %242q0e%241%40blaine.gmane.org There are other more-apropos threads in the archives, though I'm too lazy to go find them right now. IMO the problem here is an assumption that SQL NULL should be interchangeable with a JSON NULL. It's not, and we don't intend to make it so, because (a) the definitional quagmire that would result is bottomless; (b) people asking for this are generally trying to use SQL NULL as a live data value, which is almost always just a bad idea. regards, tom lane