BUG #13961: Unexpected behaviour of JSONB_SET if the new_value is null

From: pravin(at)gida(dot)in
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13961: Unexpected behaviour of JSONB_SET if the new_value is null
Date: 2016-02-15 08:02:40
Message-ID: 20160215080240.2605.67223@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: 13961
Logged by: Pravin Carvalho
Email address: pravin(at)gida(dot)in
PostgreSQL version: 9.5.1
Operating system: All
Description:

If the new_value is null, JSONB_SET evaluates to null. This is not mentioned
in the documentation and intuitively I would expect this set the value of
the key at the specified path as null.
eg. SELECT jsonb_set('{"f1":1,"f2":2}', '{f2}',null);

I was using JSONB_SET to update a JSONB column where the new_value was the
result of the query and this could have led to loss of data.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message chandrakant sharma 2016-02-15 11:27:50 Row count mismatch post pg_dump piped restore
Previous Message Magnus Hagander 2016-02-15 07:33:53 Re: Standbys using commas in application_name cannot become sync nodes