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 1eot9c-0003bI-8n for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Feb 2018 15:51:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eot9a-0007sF-Mo for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Feb 2018 15:51:26 +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.84_2) (envelope-from ) id 1eot9a-0007s5-Dr for pgsql-bugs@lists.postgresql.org; Thu, 22 Feb 2018 15:51:26 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eot9X-0002a5-Io for pgsql-bugs@postgresql.org; Thu, 22 Feb 2018 15:51:25 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eot7R-0006ea-1p for pgsql-bugs@postgresql.org; Thu, 22 Feb 2018 16:49:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-bugs@postgresql.org From: Thomas Kellerer Subject: Re: bug in jsonb_set porstgresql 5.5 Date: Thu, 22 Feb 2018 16:51:13 +0100 Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: Content-Language: de-DE X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pascal Barbedor schrieb am 22.02.2018 um 14:38: > I noticed a problem with a jsonb field and jsonb_set function > > - table1 is a table with *history* a jsonb field, and *obs* a text field which is null > > Those three instructions were sent to postgresql > > 1- this one is ok, set the field to an empty object > *update table1 set history=‘{}’* > > 2- this one is ok, creates a key q1 initialized at an empty object > *update table1 set history=jsonb_set(history,’{q1}’, ‘{}’)* > > *3- this one resets completely the jsonb field, not only the key obs is not set to null but the entire jsonb field is now null* > * > * > *update table1 set history=jsonb_set(history,’{q1,obs}’, to_jsonb(obs))* > > this is on postgresql 5.5 There is no PostgreSQL 5.5 (and never was if I'm not mistaken)