Re: Sorting Discrepancy in PostgreSQL 14.13 - Mailing list pgsql-bugs

From Tomas Vondra
Subject Re: Sorting Discrepancy in PostgreSQL 14.13
Date
Msg-id 69c7ee62-f9de-4365-b325-7e493203a7ae@vondra.me
Whole thread Raw
In response to Sorting Discrepancy in PostgreSQL 14.13  ([3반]김민지_4904 <hzuiw33@gmail.com>)
Responses Re: Sorting Discrepancy in PostgreSQL 14.13
List pgsql-bugs
Hi,

On 11/14/24 13:49, [3반]김민지_4904 wrote:
>
> ...
>
> The minimized PoC is:
> 
> ```sql
> CREATE TABLE t0 (c0 TEXT);
> INSERT INTO t0 (c0) VALUES ('-10'), ('20'), ('-5'), ('15'), ('-25');
> SELECT c0 FROM t0 ORDER BY c0;
> ```
> 
> In PostgreSQL 14.13, the order is incorrect:
> ```
> -10
> 15
> 20
> -25
> -5
> ```
> 
> While the correct order should be:
> 
> ```
> -10
> -25
> -5
> 10
> 20
> ```
> 
> as '-' is smaller than '1', or '2' in ascii.
> 
> I'm doubtful this is a collation issue, as most collations basically
> respect ASCII order.
> 

This is 99.999% due to the collation, so which collations are being used
on these systems? Also, I don't get this "incorrect" behavior on 14.13,
it behaves the same as 17 for me, producing the expected result.


regards

-- 
Tomas Vondra




pgsql-bugs by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: Regression from postgresql14 to postgresql17 with postgis (osm2pgsql)
Next
From: Aleksander Alekseev
Date:
Subject: Re: BUG #18708: regex problem: (?:[^\d\D]){0} asserts with "lp->nouts == 0 && rp->nins == 0"