]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix UUID sortability tests in base32hex encoding.
authorMasahiko Sawada <msawada@postgresql.org>
Thu, 26 Mar 2026 03:12:26 +0000 (20:12 -0700)
committerMasahiko Sawada <msawada@postgresql.org>
Thu, 26 Mar 2026 03:12:26 +0000 (20:12 -0700)
Commit 497c1170cb1 added base32hex encoding support, but its
regression test for UUIDs failed on buildfarm members hippopotamus and
jay using natural language locales (such as cs_CZ). This happened
because those collations may sort characters differently, which breaks
the strict byte-wise lexicographical ordering expected by base32hex
encoding.

This commit fixes the regression tests by explicitly using the C
collation.

Per buildfarm members hippopotamus and jay.

Analyzed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/682417.1774482047@sss.pgh.pa.us

src/test/regress/expected/uuid.out
src/test/regress/sql/uuid.sql

index 142c529e693828a7dbc736106b0332405f5a03de..9c5dda9e9abb1db7872b455091ed3a6f2d9fbe9c 100644 (file)
@@ -236,8 +236,11 @@ SELECT array_agg(id ORDER BY guid_field) FROM guid3;
  {1,2,3,4,5,6,7,8,9,10,11,12}
 (1 row)
 
--- make sure base32hex encoding works with UUIDs and preserves ordering
-SELECT array_agg(id ORDER BY guid_encoded) FROM guid3;
+-- Test base32hex encoding of UUIDs and its lexicographical sorting property.
+-- COLLATE "C" is required to prevent buildfarm failures in non-C locales
+-- where natural language collations (such as cs_CZ) would break strict
+-- byte-wise ordering.
+SELECT array_agg(id ORDER BY guid_encoded COLLATE "C") FROM guid3;
           array_agg           
 ------------------------------
  {1,2,3,4,5,6,7,8,9,10,11,12}
index f2ff00f5ddde78c8812ad8e228c7d233ecc997d2..8cc2ad40614ae1873c6edca0a068f38212b5ec46 100644 (file)
@@ -122,8 +122,11 @@ INSERT INTO guid3 (guid_field) SELECT uuidv7() FROM generate_series(1, 10);
 INSERT INTO guid3 (guid_field) VALUES ('ffffffff-ffff-ffff-ffff-ffffffffffff'::uuid);
 SELECT array_agg(id ORDER BY guid_field) FROM guid3;
 
--- make sure base32hex encoding works with UUIDs and preserves ordering
-SELECT array_agg(id ORDER BY guid_encoded) FROM guid3;
+-- Test base32hex encoding of UUIDs and its lexicographical sorting property.
+-- COLLATE "C" is required to prevent buildfarm failures in non-C locales
+-- where natural language collations (such as cs_CZ) would break strict
+-- byte-wise ordering.
+SELECT array_agg(id ORDER BY guid_encoded COLLATE "C") FROM guid3;
 
 -- Check the timestamp offsets for v7.
 --