commit 6f4c911aa98b7ced0b8e93d36e222531cd4f1c87 Author: yanchengpeng Date: Mon Dec 9 12:59:28 2024 +0000 docs: Clarify JSONB sorting for empty arrays Added a note to the JSONB documentation explaining that empty arrays sort less than null, due to historical reasons. This provides better clarity on JSONB sorting rules. diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml index 54648c459c..2870df34d8 100644 --- a/doc/src/sgml/json.sgml +++ b/doc/src/sgml/json.sgml @@ -590,6 +590,7 @@ SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"'; Array with n elements > array with n - 1 elements + with the exception that (for historical reasons) an empty array sorts less than null. Objects with equal numbers of pairs are compared in the order: key-1, value-1, key-2 ...