BUG #18368: order by collation doesn't work as expected for the second column in the ORDER BY list

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: octavian(at)codrut-popescu(dot)com
Subject: BUG #18368: order by collation doesn't work as expected for the second column in the ORDER BY list
Date: 2024-02-27 18:00:17
Message-ID: 18368-000eb75b438d3b72@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18368
Logged by: Octavian-Codrut Popescu
Email address: octavian(at)codrut-popescu(dot)com
PostgreSQL version: 16.2
Operating system: Linux
Description:

codrut=# create collation german_custom_codrut(provider = icu, locale =
'de_DE(dot)utf8(at)colReorder=latn-digit');
NOTICE: using standard form "de-DE-u-kr-latn-digit" for ICU locale
"de_DE(dot)utf8(at)colReorder=latn-digit"
CREATE COLLATION
codrut=#
codrut=#
codrut=# with v (a, b) as (values ('83000003', '123abc'), ('83000003',
'abc123'), ('83000004', 'ABC123'))
codrut-# select a,b from v order by a, b collate "german_custom_codrut";
a | b
----------+--------
83000003 | 123abc
83000003 | abc123
83000004 | ABC123
(3 rows)

codrut=# with v (a, b) as (values ('83000003', '123abc'), ('83000003',
'abc123'), ('83000004', 'ABC123'))
codrut-# select a,b from v where a = '83000003' order by a, b collate
"german_custom_codrut";
a | b
----------+--------
83000003 | abc123
83000003 | 123abc
(2 rows)

codrut=# select version();
version

------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 16.2 (Postgres.app) on aarch64-apple-darwin21.6.0, compiled by
Apple clang version 14.0.0 (clang-1400.0.29.102), 64-bit
(1 row)

basically just introducing or removing where a = '83000003' changes the
ORDER BY behavior.

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-02-27 18:14:43 Re: BUG #18367: Cannot drop schema
Previous Message Jim Wilson 2024-02-27 17:26:38 Feature bug dumpall CREATE ROLE postgres