Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f30z1-0005Sy-Cq for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Apr 2018 15:02:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f30z0-0001t4-Gm for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Apr 2018 15:02:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f30z0-0001sv-7G for pgsql-bugs@lists.postgresql.org; Mon, 02 Apr 2018 15:02:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f30yx-00036k-Kw for pgsql-bugs@lists.postgresql.org; Mon, 02 Apr 2018 15:02:52 +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 w32F2nS1002395; Mon, 2 Apr 2018 11:02:49 -0400 From: Tom Lane To: "Ivan E. Panchenko" cc: Dmitry Dolgov <9erthalion6@gmail.com>, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15140: Incorrect jsonb_set behavoir In-reply-to: <3ab7ce91-9d9e-8b82-e77f-73d2da52c17e@postgrespro.ru> References: <152266540508.1442.16790414733320933622@wrigleys.postgresql.org> <3ab7ce91-9d9e-8b82-e77f-73d2da52c17e@postgrespro.ru> Comments: In-reply-to "Ivan E. Panchenko" message dated "Mon, 02 Apr 2018 17:58:15 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2393.1522681369.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 02 Apr 2018 11:02:49 -0400 Message-ID: <2394.1522681369@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Ivan E. Panchenko" writes: > Thanks for the workaround.  Nevertheless, this behavior looks > counter-intuitive, and I would vote for removing strictness from this > function. That would amount to assuming that SQL NULL and JSON 'null' are interchangeable, which isn't the case elsewhere, and I'm not sure we want it to be the case here. You can get the behavior you're looking for with jsonb_set(..., COALESCE(fieldvalue, 'null')). regards, tom lane