Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit591128f

Browse files
committed
Document strange jsonb sort order for empty top level arrays
Slightly faulty logic in the original jsonb code (commitd9134d0)results in an empty top level array sorting less than a json null. Wecan't change the sort order now since it would affect btree indexes overjsonb, so document the anomaly.Backpatch to all live branches (13 .. 17)In master, also add a code comment noting the anomaly.Reported-by: Yan ChengpenReviewed-by: Jian HeDiscussion:https://postgr.es/m/OSBPR01MB45199DD8DA2D1CECD50518188E272@OSBPR01MB4519.jpnprd01.prod.outlook.com
1 parent297b280 commit591128f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎doc/src/sgml/json.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,13 @@ SELECT jdoc->'guid', jdoc->'name' FROM api WHERE jdoc @@ '$.tags[*] == "qui"';
584584
The <literal>btree</literal> ordering for <type>jsonb</type> datums is seldom
585585
of great interest, but for completeness it is:
586586
<synopsis>
587-
<replaceable>Object</replaceable> > <replaceable>Array</replaceable> > <replaceable>Boolean</replaceable> > <replaceable>Number</replaceable> > <replaceable>String</replaceable> > <replaceable>Null</replaceable>
587+
<replaceable>Object</replaceable> > <replaceable>Array</replaceable> > <replaceable>Boolean</replaceable> > <replaceable>Number</replaceable> > <replaceable>String</replaceable> > <replaceable>null</replaceable>
588588

589589
<replaceable>Object with n pairs</replaceable> > <replaceable>object with n - 1 pairs</replaceable>
590590

591591
<replaceable>Array with n elements</replaceable> > <replaceable>array with n - 1 elements</replaceable>
592592
</synopsis>
593+
with the exception that (for historical reasons) an empty top level array sorts less than <replaceable>null</replaceable>.
593594
Objects with equal numbers of pairs are compared in the order:
594595
<synopsis>
595596
<replaceable>key-1</replaceable>, <replaceable>value-1</replaceable>, <replaceable>key-2</replaceable> ...

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp