| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | theshallow27(at)gmail(dot)com |
| Subject: | BUG #19735: `jsonb_object_agg_unique_strict` drops a JSONB `null` value as if it were SQL NULL |
| Date: | 2026-10-02 22:03:41 |
| Message-ID: | 19735-488819822dc79bca@postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 19735
Logged by: Shallow
Email address: theshallow27(at)gmail(dot)com
PostgreSQL version: 18.6
Operating system: Linux
Description:
The strict JSONB object aggregate omits a non-SQL-NULL `jsonb` datum whose
JSON
value is `null`. The corresponding non-strict JSONB aggregate and strict
JSON
aggregate preserve the key with a JSON null value. The aggregate
documentation
says that strict mode skips a value when the value is NULL; a JSONB `null`
value
is distinct from SQL NULL.
**Reproduction:**
```sql
SELECT jsonb_object_agg_unique_strict('a', 'null'::jsonb)::text,
jsonb_object_agg_unique('a', 'null'::jsonb)::text,
json_object_agg_unique_strict('a', 'null'::jsonb)::text;
```
**Actual result:**
```text
{} | {"a": null} | { "a" : null }
```
**Expected result:** The strict JSONB aggregate should skip SQL NULL values
but
preserve a JSONB datum containing JSON `null`, consistent with the other two
aggregate results.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | PG Bug reporting form | 2026-10-02 22:35:57 | BUG #19736: `JSON_OBJECT ... ABSENT ON NULL` accepts invalid keys when the value is NULL |
| Previous Message | Heikki Linnakangas | 2026-10-02 21:55:25 | Re: BUG #19628: Uninterruptible vacuum during hash index processing |