diff options
author | Jeff Davis | 2024-07-30 07:58:06 +0000 |
---|---|---|
committer | Jeff Davis | 2024-07-30 07:58:06 +0000 |
commit | 72fe6d24a38c88e112d5e63a8e907c3e96ae46ad (patch) | |
tree | 73bff00c25ec951c6fcd7781b17e1590511c895a /src/test/regress/sql/collate.utf8.sql | |
parent | 9b282a9359a12831c087eba7f0f5f0b1dba7b7eb (diff) |
Make collation not depend on setlocale().
Now that the result of pg_newlocale_from_collation() is always
non-NULL, then we can move the collate_is_c and ctype_is_c flags into
pg_locale_t. That simplifies the logic in lc_collate_is_c() and
lc_ctype_is_c(), removing the dependence on setlocale().
This commit also eliminates the multi-stage initialization of the
collation cache.
As long as we have catalog access, then it's now safe to call
pg_newlocale_from_collation() without checking lc_collate_is_c()
first.
Discussion: https://postgr.es/m/[email protected]
Reviewed-by: Peter Eisentraut, Andreas Karlsson
Diffstat (limited to 'src/test/regress/sql/collate.utf8.sql')
-rw-r--r-- | src/test/regress/sql/collate.utf8.sql | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/sql/collate.utf8.sql b/src/test/regress/sql/collate.utf8.sql index 1f5f9ef491d..87fe06ddf1b 100644 --- a/src/test/regress/sql/collate.utf8.sql +++ b/src/test/regress/sql/collate.utf8.sql @@ -12,6 +12,21 @@ SELECT getdatabaseencoding() <> 'UTF8' AS skip_test \gset SET client_encoding TO UTF8; -- +-- Test builtin "C" +-- +CREATE COLLATION regress_builtin_c ( + provider = builtin, locale = 'C'); + +-- non-ASCII characters are unchanged +SELECT LOWER(U&'\00C1' COLLATE regress_builtin_c) = U&'\00C1'; +SELECT UPPER(U&'\00E1' COLLATE regress_builtin_c) = U&'\00E1'; + +-- non-ASCII characters are not alphabetic +SELECT U&'\00C1\00E1' !~ '[[:alpha:]]' COLLATE regress_builtin_c; + +DROP COLLATION regress_builtin_c; + +-- -- Test PG_C_UTF8 -- |