postgres.git / summary / log / commit / refs
commit 4776a9ac0a7e29bed078f63d4f8576bdf6651f4c
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed Oct 14 18:00:30 2026 +0000
First released in: 14.25, 15.20, 16.16, 17.12, 18.7, 19.0
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 <zhong950419@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
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 bb36e803e19..2097966e621 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -19589,7 +19589,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 <function>to_json</function> or <function>to_jsonb</function>.
- Values can be null, but not keys.
+ Values can be null, but keys cannot.
+ If a key appears more than once, the <type>json</type> result keeps
+ every pair, while the <type>jsonb</type> result keeps only the last
+ value for that key.
</para></entry>
<entry>No</entry>
</row>
[parent: 83be644888b8]