BUG #15075: jsonb_set return [null] if new value is null but not 'null'.

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: claudel(dot)sylvain(at)gmail(dot)com
Subject: BUG #15075: jsonb_set return [null] if new value is null but not 'null'.
Date: 2018-02-19 08:33:49
Message-ID: 151902922995.1388.15352428607143555614@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15075
Logged by: Sylvain Claudel
Email address: claudel(dot)sylvain(at)gmail(dot)com
PostgreSQL version: 10.1
Operating system: MacOSX
Description:

This behavior is it normal ?

select jsonb_set('{"f1":1,"f2":null,"f3":"bidule"}', '{f3}', null, false);

#> [null]

select jsonb_set('{"f1":1,"f2":null,"f3":"bidule"}', '{f3}', 'null',
false);

#> {"f1":1,"f2":null,"f3":null}

In a update query, it is dangerous.
It may be better that the request crashes rather than executing with
surprising behavior.

Tested in postgresql 9.6.4 and 10.1 but nothing on the changelog concerning
jsonb_set since 9.6.1.

Sorry if this report is not "clean".

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-02-19 09:18:23 Re: BUG #15075: jsonb_set return [null] if new value is null but not 'null'.
Previous Message PG Bug reporting form 2018-02-19 08:26:48 BUG #15074: psql client never returns when creating index (long running operation)