From 2ad0b0f8c1b03433a77b4ebd2b70a8cc2b3d381e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 14 Oct 2026 14:00:30 -0400 Subject: [PATCH] Doc: improve documentation of the JSON object aggregates. Say which value wins for a repeated key, and how skipped null values interact with that and with the unique check. Also point out that duplicate keys behave differently for json and jsonb cases. (I still think that's a bug, but at least now it's documented.) Author: shihao zhong Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CAGRkXqTCfSu=aEUCvKDTGroEWOcyz3MCv4Xi8x1PZ1T1rEmG=Q@mail.gmail.com Backpatch-through: 14 --- doc/src/sgml/func.sgml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index c433690fe18..5d3871ed503 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -19999,7 +19999,10 @@ SELECT NULLIF(value, '(none)') ... Collects all the key/value pairs into a JSON object. Key arguments are coerced to text; value arguments are converted as per to_json or to_jsonb. - Values can be null, but not keys. + Values can be null, but keys cannot. + If a key appears more than once, the json result keeps + every pair, while the jsonb result keeps only the last + value for that key. No