postgres.git / summary / log / commit / refs

commit    33b8a42dfba090cf140f8e5d01c4eddf2c08100c
Author:   Andrew Dunstan <andrew@dunslane.net>
Date:     Sat Aug 22 21:47:24 2026 +0000
First released in: 17.12, 18.7

    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>


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 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'); [parent: 2ae67ada74d9]