Re: JSON array is not updated if updating with empty array

From: "Radics, Geza" <radicsge(at)protonmail(dot)com>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: Radics Geza <radicsge(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: JSON array is not updated if updating with empty array
Date: 2020-03-06 19:33:23
Message-ID: N0qCAAOx4exeFGH64__1_LceXkGJbycKu0AtgZWeWrzu-vt2hMR1Ej5vCbyNdOluoHV_FiAm8FkiZ_LQjcLsNH1Z_RIx_3MMmsKLhIXxmLE=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Sorry you are right it seems one of the triggers caused an issue on my table, then please ignore.
I will check it further.

Thanks a lot for your time!

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, March 6, 2020 7:24 PM, Christophe Pettus <xof(at)thebuild(dot)com> wrote:

>
>
> > On Mar 6, 2020, at 11:21, Radics Geza radicsge(at)gmail(dot)com wrote:
> > 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=# 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(at)thebuild(dot)com

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2020-03-06 22:23:40 Re: BUG #16285: bt_metap fails with value is out of range for type integer
Previous Message Christophe Pettus 2020-03-06 19:24:16 Re: JSON array is not updated if updating with empty array