Re: [PATCH] Fix jsonb comparison for raw scalar pseudo arrays

From: Yan Chengpeng <chengpeng_yan(at)outlook(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Fix jsonb comparison for raw scalar pseudo arrays
Date: 2024-12-09 13:22:45
Message-ID: OSBPR01MB45195E808FEA422E895C47558E3C2@OSBPR01MB4519.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

If many people are already using this ‘wrong’ behavior. I agree to change the doc. I also think using ‘null’ may be a better choice. Thanks for your comments.

From: jian he <jian(dot)universality(at)gmail(dot)com>
Date: Monday, December 9, 2024 at 16:56
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Yan Chengpeng <chengpeng_yan(at)outlook(dot)com>, pgsql-hackers(at)postgresql(dot)org <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Fix jsonb comparison for raw scalar pseudo arrays
On Sun, Dec 8, 2024 at 10:58 PM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
> So the actual sort order as implemented is, AIUI,
>
> Object > Non-Empty-Array > Boolean > Number > String > Null > Empty-Array
>
> which is ugly, but fortunately not many apps rely on jsonb sort order.
>
> Nobody else has commented, so I propose to apply this patch documenting the anomaly.
>

while at it. we can fix the appearance of jsonb null.

since
select jsonb 'Null';
select jsonb 'NULL';
will fail.

so maybe change
<replaceable>Null</replaceable> in <synopsis> section and
<replaceable>NULL</replaceable>
to
<replaceable>null</replaceable>

Attachment Content-Type Size
v1-0001-fix-jsonb-compare.patch application/octet-stream 5.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2024-12-09 13:25:54 Re: Track the amount of time waiting due to cost_delay
Previous Message Pritam Baral 2024-12-09 13:20:41 Subscription sometimes loses txns after initial table sync