From 073bd832772fa9ee2460d8420d2275687fbe88bc Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sat, 22 Aug 2026 17:47:24 -0400 Subject: [PATCH] Pin two ctype-dependent test_regex_utf8 cases to pg_c_utf8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_regex_utf8 decides whether to run by looking at the database encoding alone, but two of its cases, [[:graph:]] and [[:print:]] over E'xᔀሷ', depend on the ctype as well. In a database with encoding UTF8 and locale C they match just the x, because isgraph() and isprint() are false for anything outside ASCII, and the file fails. No buildfarm animal builds such a cluster, which is why this went unnoticed, and why the to_date() crash in 18.5 went undetected for want of exactly this coverage. A pending buildfarm client change will let an animal be configured that way. Fix by giving the two cases an explicit collation, so that they exercise a fixed Unicode ctype instead of whatever the database happened to be initialized with. test_regex() already passes its input collation down to the regex compiler. The expected results are unchanged; only the echoed queries differ. Backpatch-through: 17 (15 and 16 get a different fix) Reviewed-by: Jonathan Gonzalez V. --- src/test/modules/test_regex/expected/test_regex_utf8.out | 6 ++++-- src/test/modules/test_regex/sql/test_regex_utf8.sql | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/test/modules/test_regex/expected/test_regex_utf8.out b/src/test/modules/test_regex/expected/test_regex_utf8.out index 329780ef400..177eb1cacec 100644 --- a/src/test/modules/test_regex/expected/test_regex_utf8.out +++ b/src/test/modules/test_regex/expected/test_regex_utf8.out @@ -147,7 +147,9 @@ select * from test_regex('[[:digit:]]+', E'x9\u1500\u1237', 'L'); {9} (2 rows) -select * from test_regex('[[:graph:]]+', E'x\u1500\u1237', 'L'); +-- graph and print depend on the ctype and not just the encoding, so pin them +-- to a Unicode-aware collation rather than the database's +select * from test_regex('[[:graph:]]+', E'x\u1500\u1237' COLLATE pg_c_utf8, 'L'); test_regex ----------------- {0,REG_ULOCALE} @@ -161,7 +163,7 @@ select * from test_regex('[[:lower:]]+', E'x\u1500\u1237', 'L'); {x} (2 rows) -select * from test_regex('[[:print:]]+', E'x\u1500\u1237', 'L'); +select * from test_regex('[[:print:]]+', E'x\u1500\u1237' COLLATE pg_c_utf8, 'L'); test_regex ----------------- {0,REG_ULOCALE} diff --git a/src/test/modules/test_regex/sql/test_regex_utf8.sql b/src/test/modules/test_regex/sql/test_regex_utf8.sql index 1f69f105fd7..d00599b3490 100644 --- a/src/test/modules/test_regex/sql/test_regex_utf8.sql +++ b/src/test/modules/test_regex/sql/test_regex_utf8.sql @@ -66,9 +66,11 @@ select * from test_regex('[[:ascii:]]+', E'x\u1500\u1237', 'L'); select * from test_regex('[[:blank:]]+', E'x \t\u1500\u1237', 'L'); select * from test_regex('[[:cntrl:]]+', E'x\u1500\u1237', 'L'); select * from test_regex('[[:digit:]]+', E'x9\u1500\u1237', 'L'); -select * from test_regex('[[:graph:]]+', E'x\u1500\u1237', 'L'); +-- graph and print depend on the ctype and not just the encoding, so pin them +-- to a Unicode-aware collation rather than the database's +select * from test_regex('[[:graph:]]+', E'x\u1500\u1237' COLLATE pg_c_utf8, 'L'); select * from test_regex('[[:lower:]]+', E'x\u1500\u1237', 'L'); -select * from test_regex('[[:print:]]+', E'x\u1500\u1237', 'L'); +select * from test_regex('[[:print:]]+', E'x\u1500\u1237' COLLATE pg_c_utf8, 'L'); select * from test_regex('[[:punct:]]+', E'x.\u1500\u1237', 'L'); select * from test_regex('[[:space:]]+', E'x \t\u1500\u1237', 'L'); select * from test_regex('[[:upper:]]+', E'xX\u1500\u1237', 'L');