Re: bug in jsonb_set postgresql 5.5 - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: bug in jsonb_set postgresql 5.5
Date
Msg-id CAKFQuwaUxXcWPi6p+JVo-6WuKc_7CJDswHHkvqh5KYp3OZwGow@mail.gmail.com
Whole thread Raw
In response to bug in jsonb_set porstgresql 5.5  (Pascal Barbedor <pbarbedor@blset.com>)
List pgsql-bugs
On Thu, Feb 22, 2018 at 8:51 AM, Pascal Barbedor <pbarbedor@blset.com> wrote:
Thanks for the answer

Where is this mentioned in the doc ?

Since it is only a key inside the json object which is assigned the null value, does it mean it is impossible to have null values inside the jsonb object ?


​The docs don't indicate whether functions are strict or not (nor apparently does psql's \df+)...but the behavior of strict functions is documented (at least in CREATE FUNCTION for when you are creating your own).

It is indeed impossible to place an SQL NULL inside of a json object - you can place a json null inside a json object though - thus you need to convert from SQL NULL to json null explicitly (typically via COALESCE):

jsonb_set​(history, '{q1,obs}', COALESCE(to_jsonb(obs), 'null'))

David J.

pgsql-bugs by date:

Previous
From: Pascal Barbedor
Date:
Subject: Re: bug in jsonb_set postgresql 5.5
Next
From: PG Bug reporting form
Date:
Subject: BUG #15077: Unable to receive data from WAL Stream Error