Re: [PATCH] Fix jsonb comparison for raw scalar pseudo arrays - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: [PATCH] Fix jsonb comparison for raw scalar pseudo arrays
Date
Msg-id 5ead8eb7-4d97-460e-8c0c-b04a6b1e9cf5@dunslane.net
Whole thread Raw
In response to Re: [PATCH] Fix jsonb comparison for raw scalar pseudo arrays  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On 2024-12-09 Mo 11:16 AM, jian he wrote:
> On Mon, Dec 9, 2024 at 9:27 PM Yan Chengpeng <chengpeng_yan@outlook.com> wrote:
>> Sorry, I uploaded the wrong file. I uploaded a new patch with the modified document. Please take a review. Thanks!
>>
>>
> sorry. maybe i didn't mention it explicitly.
> i mean something like:
>
> diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml
> index 54648c459c..d9b24e413e 100644
> --- a/doc/src/sgml/json.sgml
> +++ b/doc/src/sgml/json.sgml
> @@ -584,12 +584,13 @@ SELECT jdoc->'guid', jdoc->'name' FROM api WHERE
> jdoc @@ '$.tags[*] == "qui"';
>       The <literal>btree</literal> ordering for <type>jsonb</type>
> datums is seldom
>       of great interest, but for completeness it is:
>   <synopsis>
> -<replaceable>Object</replaceable> > <replaceable>Array</replaceable>
>> <replaceable>Boolean</replaceable> >
> <replaceable>Number</replaceable> > <replaceable>String</replaceable>
>> <replaceable>Null</replaceable>
> +<replaceable>Object</replaceable> > <replaceable>Array</replaceable>
>> <replaceable>Boolean</replaceable> >
> <replaceable>Number</replaceable> > <replaceable>String</replaceable>
>> <replaceable>null</replaceable>
>   <replaceable>Object with n pairs</replaceable> > <replaceable>object
> with n - 1 pairs</replaceable>
>
>   <replaceable>Array with n elements</replaceable> > <replaceable>array
> with n - 1 elements</replaceable>
>   </synopsis>
> +      with the exception that (for historical reasons) an empty array
> sorts less than <replaceable>null</replaceable>.
>         Objects with equal numbers of pairs are compared in the order:
>   <synopsis>
>   <replaceable>key-1</replaceable>, <replaceable>value-1</replaceable>,
> <replaceable>key-2</replaceable> ...



Pushed something along these lines. In master I also added a code 
comment so nobody might be tempted to "fix" the anomaly.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com








pgsql-hackers by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: Remove unused rel parameter in lookup_var_attr_stats
Next
From: Japin Li
Date:
Subject: Re: Modern SHA2- based password hashes for pgcrypto