Why does jsonb_set() remove non-mentioned keys? - Mailing list pgsql-general

From Thomas Kellerer
Subject Why does jsonb_set() remove non-mentioned keys?
Date
Msg-id qfkua9$2q0e$1@blaine.gmane.org
Whole thread Raw
Responses Re: Why does jsonb_set() remove non-mentioned keys?
List pgsql-general
Why does 

   select jsonb_set('{"foo": 1}'::jsonb, '{bar}', to_jsonb(null::int), true)

return NULL when all it should do is to add a second key?

I would expect {"foo": 1, "bar": null} or no change at all to the original JSON value, but not that the whole JSON is
setto null. 
 

In the original case the new value to be set was the result of an expression, not a "hardcoded" null value.
 
Thomas






pgsql-general by date:

Previous
From: Andrey Sychev
Date:
Subject: Error: rows returned by function are not all of the same row type
Next
From: Tom Lane
Date:
Subject: Re: Error: rows returned by function are not all of the same row type