Re: Unexpected behavior of jsonb_set() with a `null` value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: Марк <kolypto(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Unexpected behavior of jsonb_set() with a `null` value
Date: 2019-09-12 14:32:00
Message-ID: 19278.1568298720@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thomas Kellerer <spam_eater(at)gmx(dot)net> writes:
> Марк schrieb am 12.09.2019 um 12:55:
>> The expected behavior is, perhaps, to convert an SQL `NULL` value to JSONB null value: 'null'::jsonb

> I have asked the same: https://www.postgresql.org/message-id/flat/qfkua9%242q0e%241%40blaine.gmane.org

There are other more-apropos threads in the archives, though I'm too
lazy to go find them right now. IMO the problem here is an assumption
that SQL NULL should be interchangeable with a JSON NULL. It's not,
and we don't intend to make it so, because (a) the definitional quagmire
that would result is bottomless; (b) people asking for this are generally
trying to use SQL NULL as a live data value, which is almost always just
a bad idea.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-09-12 16:51:01 BUG #16006: Update queries fail on a table having any policy with a function that takes a whole-row var as arg
Previous Message Thomas Kellerer 2019-09-12 14:11:52 Re: Unexpected behavior of jsonb_set() with a `null` value