Re: JSON array is not updated if updating with empty array - Mailing list pgsql-bugs

From Christophe Pettus
Subject Re: JSON array is not updated if updating with empty array
Date
Msg-id 79492C80-5C4C-4D29-8EEE-CD0F66469034@thebuild.com
Whole thread Raw
In response to Re: JSON array is not updated if updating with empty array  (Radics Geza <radicsge@gmail.com>)
Responses Re: JSON array is not updated if updating with empty array  ("Radics, Geza" <radicsge@protonmail.com>)
List pgsql-bugs

> On Mar 6, 2020, at 11:21, Radics Geza <radicsge@gmail.com> wrote:
>
> I should have written that the precondition is that the column should contains a non-empty json array before the
updateas 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=# create table t (j jsonb);
CREATE TABLE
xof=# insert into t values('[{"b": 1}]');
INSERT 0 1
xof=# update t set j = '[{"a": 1}]';
UPDATE 1
xof=# table t;
     j
------------
 [{"a": 1}]
(1 row)

xof=# update t set j = '[]';
UPDATE 1
xof=# table t;
 j
----
 []
(1 row)

--
-- Christophe Pettus
   xof@thebuild.com




pgsql-bugs by date:

Previous
From: Jeff Janes
Date:
Subject: Re: JSON array is not updated if updating with empty array
Next
From: "Radics, Geza"
Date:
Subject: Re: JSON array is not updated if updating with empty array