Re: bug in jsonb_set postgresql 5.5

From: Pascal Barbedor <pbarbedor(at)blset(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Postgres Bug <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: bug in jsonb_set postgresql 5.5
Date: 2018-02-22 15:51:15
Message-ID: AA261343-E741-4E6B-98F1-6496B3A44795@blset.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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 ?

> Le 22 févr. 2018 à 16:42, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> a écrit :
>
> On Thu, Feb 22, 2018 at 6:38 AM, Pascal Barbedor <pbarbedor(at)blset(dot)com <mailto:pbarbedor(at)blset(dot)com>> wrote:
> Hello
>
>
> I noticed a problem with a jsonb field and jsonb_set function
>
>
> - table1 is a table with history a jsonb field, and obs a text field which is null
>
> ​[...]​
> 3- this one resets completely the jsonb field, not only the key obs is not set to null but the entire jsonb field is now null
>
> update table1 set history=jsonb_set(history,’{q1,obs}’, to_jsonb(obs))
>
> ​Working as designed - jsonb_set​ and to_jsonb are both defined as "NULL ON NULL INPUT (i.e., STRICT)" - since "obs [is] a text field which is null" the final result of the function call is NULL.
>
> ​David J.
> ​

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2018-02-22 16:02:18 Re: bug in jsonb_set postgresql 5.5
Previous Message Thomas Kellerer 2018-02-22 15:51:13 Re: bug in jsonb_set porstgresql 5.5