Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: theshallow27(at)gmail(dot)com
Subject: Re: BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL
Date: 2026-10-04 19:38:11
Message-ID: CAGRkXqS7KdfpuBJELU_K-c69REdtJGvgn76p0h9O4mBk=MOSmQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I can reproduce this on master. The same happens with all the
skip_nulls paths, such as jsonb_object_agg_strict(), and JSON_OBJECT()
and JSON_OBJECTAGG() using ABSENT ON NULL RETURNING jsonb. The jsonb
array versions keep the value, jsonb_agg_strict('null'::jsonb) returns
[null].

Is dropping JSON nulls here intended? I looked at the old threads
where skip_nulls was discussed [1][2], they are only about SQL NULLs.
The docs just say "null".

If people want this changed I can draft a patch.

[1]
https://www.google.com/url?q=https://postgr.es/m/CAJA4AWQ_XbSmsNbW226UqNyRLJ%2Bwb%3DiQkQMj77cQyoNkqtf%3D2Q@mail.gmail.com&source=gmail&ust=1791228842559000&sa=E

[2]
https://www.google.com/url?q=https://postgr.es/m/CA%2BHiwqGAJb%2BmQKFPf6Vov9HsdzCSq21Guy4uwerZDAyWWZqNaQ@mail.gmail.com&source=gmail&ust=1791228842559000&sa=E

Thanks,
Shihao

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-10-04 19:39:25 Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"
Previous Message shihao zhong 2026-10-04 18:41:25 Re: BUG #19742: `INTERSECT` under a `UNION ALL` with an empty arm fails with "could not find pathkey item t"