From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
Cc: | Stuart McGraw <smcg4191(at)mtneva(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: jsonb_set() strictness considered harmful to data |
Date: | 2019-10-24 20:17:58 |
Message-ID: | 20073.1571948278@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> On Wed, 2019-10-23 at 13:00 -0600, Stuart McGraw wrote:
>> It is less sensible with compound values where the rule can apply to
>> individual scalar components.
I agree that JSON can sensibly be viewed as a composite value, but ...
>> And indeed that is what Postgresql does
>> for another compound type:
>>
>> # select array_replace(array[1,2,3],2,NULL);
>> array_replace
>> ---------------
>> {1,NULL,3}
>>
>> The returned value is not NULL. Why the inconsistency between the array
>> type and json type?
... the flaw in this argument is that the array element is actually
a SQL NULL when we're done. To do something similar in the JSON case,
we have to translate SQL NULL to JSON null, and that's cheating to
some extent. They're not the same thing (and I'll generally resist
proposals to, say, make SELECT 'null'::json IS NULL return true).
Maybe it's okay to make this case work like that, but don't be too
high and mighty about it being logically clean; it isn't.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2019-10-24 21:25:12 | Re: EXPLAIN BUFFERS and I/O timing accounting questions |
Previous Message | Jeff Lanzarotta | 2019-10-24 20:09:02 | Re: SQL Error [0A000]: ERROR: nondeterministic collations are not supported for LIKE |
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Adriaanse | 2019-10-24 20:20:00 | TOAST corruption in standby database |
Previous Message | Laurenz Albe | 2019-10-24 19:15:42 | Re: jsonb_set() strictness considered harmful to data |