summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan2026-08-22 21:47:24 +0000
committerAndrew Dunstan2026-08-26 20:24:07 +0000
commit8554d746964dd6ceaea827e7edbc45a1bc5948c9 (patch)
treee10d88f0d06b6360532cc9a8fabc3aa737b0c5d1 /src
parent74c9832ca61037eec25b8f214fc71883494900d8 (diff)
Pin two ctype-dependent test_regex_utf8 cases to pg_c_utf8
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. <jonathan@abdiel.eu>
Diffstat (limited to 'src')
-rw-r--r--src/test/modules/test_regex/expected/test_regex_utf8.out6
-rw-r--r--src/test/modules/test_regex/sql/test_regex_utf8.sql6
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 befd75e96f3..23dd8b2f349 100644
--- a/src/test/modules/test_regex/expected/test_regex_utf8.out
+++ b/src/test/modules/test_regex/expected/test_regex_utf8.out
@@ -148,7 +148,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}
@@ -162,7 +164,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 2aa3e0f1022..a208cf608d7 100644
--- a/src/test/modules/test_regex/sql/test_regex_utf8.sql
+++ b/src/test/modules/test_regex/sql/test_regex_utf8.sql
@@ -68,9 +68,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');