Re: BUG #15140: Incorrect jsonb_set behavoir

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ivan E(dot) Panchenko" <i(dot)panchenko(at)postgrespro(dot)ru>
Cc: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15140: Incorrect jsonb_set behavoir
Date: 2018-04-02 15:02:49
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Ivan E. Panchenko" <i(dot)panchenko(at)postgrespro(dot)ru> writes:
> Thanks for the workaround.  Nevertheless, this behavior looks
> counter-intuitive, and I would vote for removing strictness from this
> function.

That would amount to assuming that SQL NULL and JSON 'null' are
interchangeable, which isn't the case elsewhere, and I'm not sure
we want it to be the case here. You can get the behavior you're
looking for with jsonb_set(..., COALESCE(fieldvalue, 'null')).

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2018-04-02 20:24:02 Re: BUG #15112: Unable to run pg_upgrade with earthdistance extension
Previous Message Ivan E. Panchenko 2018-04-02 14:58:15 Re: BUG #15140: Incorrect jsonb_set behavoir