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

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Radics Geza <radicsge(at)gmail(dot)com>
Cc: pgsql-bugs <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:22:18
Message-ID: CAMkU=1wcY70ccxajUjSenADeTi8gwMMPUTjZhf0z4iwzgV9UHA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Mar 6, 2020 at 1:52 PM Radics Geza <radicsge(at)gmail(dot)com> wrote:

> Json column is not updated if the update is an empty array '[]'.
>
> UPDATE table SET "jsonbcol" = '[{"a":1}]';
> UPDATE table SET "jsonbcol = '[]' RETURNING "jsonbcol";
>
> jsonbcol
> ------------
> [{"a": 1}]
> (1 row)
>
> It worked in postgres 9.6, but not in 11.7 / 12.2
>

Works for me. Please show a complete working example, with CREATE TABLE,
INSER, and an UPDATE statement with legal table name and with balanced
quotes.

Cheers,

Jeff

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Christophe Pettus 2020-03-06 19:24:16 Re: JSON array is not updated if updating with empty array
Previous Message Radics Geza 2020-03-06 19:21:27 Re: JSON array is not updated if updating with empty array