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.92) (envelope-from ) id 1jAIa9-0006Wc-FC for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Mar 2020 19:24:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jAIa7-0004G4-Dt for pgsql-bugs@arkaria.postgresql.org; Fri, 06 Mar 2020 19:24:23 +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 1jAIa7-0004Fx-3L for pgsql-bugs@lists.postgresql.org; Fri, 06 Mar 2020 19:24:23 +0000 Received: from smtp80.iad3b.emailsrvr.com ([146.20.161.80]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jAIa4-0006HR-Jb for pgsql-bugs@lists.postgresql.org; Fri, 06 Mar 2020 19:24:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=g001.emailsrvr.com; s=20190322-9u7zjiwi; t=1583522658; bh=woq9MJ6X/Vp4pAMBzjw8AKbYdEZjDJ+ep9tyQpD3+/A=; h=Subject:From:Date:To:From; b=HMyOnEBcXEooJDQ2ywTboH3HinljgBUEWrFxh+HlPkLNczMh0T1nsD4omHY7T1aRr 9CwudmhigV97AEW4Zoj5Nhs7ulU4JCmoiwozRDD3z2RvoYq6JQbl5CJ77fqzG9RqKj bEgJz53WvvXNwW1yLlGFNbzT/X1A9qeYJPF85N8U= X-Auth-ID: xof@thebuild.com Received: by smtp3.relay.iad3b.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 42E9B4025C; Fri, 6 Mar 2020 14:24:18 -0500 (EST) X-Sender-Id: xof@thebuild.com Received: from [10.1.25.1] (157-131-136-66.dedicated.static.sonic.net [157.131.136.66]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:25 (trex/5.7.12); Fri, 06 Mar 2020 14:24:18 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: JSON array is not updated if updating with empty array From: Christophe Pettus In-Reply-To: Date: Fri, 6 Mar 2020 11:24:16 -0800 Cc: Tomas Vondra , pgsql-bugs@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <79492C80-5C4C-4D29-8EEE-CD0F66469034@thebuild.com> References: <20200306191814.5fioiqy6ahxv6i7n@development> To: Radics Geza X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Mar 6, 2020, at 11:21, Radics Geza wrote: >=20 > I should have written that the precondition is that the column should = contains a non-empty json array before the update as in the example. > (The insert works, the update also works if the previous content was = not an array before e.g. null or '{}' but not as above) I'm still not able to reproduce it on 11.7: xof=3D# create table t (j jsonb); CREATE TABLE xof=3D# insert into t values('[{"b": 1}]'); INSERT 0 1 xof=3D# update t set j =3D '[{"a": 1}]'; UPDATE 1 xof=3D# table t; j =20 ------------ [{"a": 1}] (1 row) xof=3D# update t set j =3D '[]'; UPDATE 1 xof=3D# table t; j =20 ---- [] (1 row) -- -- Christophe Pettus xof@thebuild.com