From 375baddd9ec7f297c2087f65879c67eaa3c81a86 Mon Sep 17 00:00:00 2001 From: shihao zhong Date: Wed, 7 Oct 2026 22:28:07 -0400 Subject: [PATCH v1] doc: Say which nulls the strict JSON object functions skip The json functions skip only SQL NULL values. The jsonb ones, and JSON_OBJECT() and JSON_OBJECTAGG() with ABSENT ON NULL RETURNING jsonb, also skip a JSON null. The docs only said "null". Discussion: https://postgr.es/m/19735-488819822dc79bca@postgresql.org --- doc/src/sgml/func/func-aggregate.sgml | 6 +++++- doc/src/sgml/func/func-json.sgml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/func/func-aggregate.sgml b/doc/src/sgml/func/func-aggregate.sgml index 6a6a4d7e32e..a16d797541a 100644 --- a/doc/src/sgml/func/func-aggregate.sgml +++ b/doc/src/sgml/func/func-aggregate.sgml @@ -432,7 +432,9 @@ are coerced to text; value arguments are converted as per to_json or to_jsonb. The key cannot be null. If the - value is null then the entry is skipped, + value is null then the entry is skipped. + jsonb_object_agg_strict also skips an entry + whose value is a JSON null. No @@ -491,6 +493,8 @@ to_json or to_jsonb. The key cannot be null. If the value is null then the entry is skipped. + jsonb_object_agg_unique_strict also skips an + entry whose value is a JSON null. If there is a duplicate key an error is thrown. No diff --git a/doc/src/sgml/func/func-json.sgml b/doc/src/sgml/func/func-json.sgml index 0763ec81ed8..bb939e792f5 100644 --- a/doc/src/sgml/func/func-json.sgml +++ b/doc/src/sgml/func/func-json.sgml @@ -731,6 +731,9 @@ if ABSENT ON NULL is specified; if NULL ON NULL is specified or the clause omitted, the key is included with value NULL. + With ABSENT ON NULL and + RETURNING jsonb, a pair whose value is a JSON + null is omitted as well. json_object('code' VALUE 'P123', 'title': 'Jaws') -- 2.37.1 (Apple Git-137.1)