Fix collate.windows.win1252 test.
authorJeff Davis <jdavis@postgresql.org>
Fri, 29 Dec 2023 19:26:10 +0000 (11:26 -0800)
committerJeff Davis <jdavis@postgresql.org>
Fri, 29 Dec 2023 19:26:10 +0000 (11:26 -0800)
Do not rely on the OS recognizing a particular locale; find the right
locale by querying the "en_US" collation.

Author: Alexander Lakhin
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/ae73f6f5-8221-c112-4640-5cda812a69de@gmail.com

src/test/regress/expected/collate.windows.win1252.out
src/test/regress/sql/collate.windows.win1252.sql

index b7b93959de995106055328b0e5e5a14985ff09a2..d99ba22431d6f74344b4c306df098bc20a50df68 100644 (file)
@@ -992,7 +992,13 @@ drop type textrange_c;
 drop type textrange_en_us;
 -- nondeterministic collations
 -- (not supported with libc provider)
-CREATE COLLATION ctest_det (locale = 'en_US', deterministic = true);
+do $$
+BEGIN
+  EXECUTE 'CREATE COLLATION ctest_det (locale = ' ||
+          quote_literal((SELECT collcollate FROM pg_collation WHERE
+          collname = 'en_US')) || ', deterministic = true);';
+  END
+$$;
 CREATE COLLATION ctest_nondet (locale = 'en_US', deterministic = false);
 ERROR:  nondeterministic collations not supported with this provider
 -- cleanup
index 353d769a5bdbdc0700cb8afa392eafeaef1c7f44..c7d6c97db1622750d1c5d994f60c2c20fc1a9f02 100644 (file)
@@ -400,8 +400,13 @@ drop type textrange_en_us;
 
 -- nondeterministic collations
 -- (not supported with libc provider)
-
-CREATE COLLATION ctest_det (locale = 'en_US', deterministic = true);
+do $$
+BEGIN
+  EXECUTE 'CREATE COLLATION ctest_det (locale = ' ||
+          quote_literal((SELECT collcollate FROM pg_collation WHERE
+          collname = 'en_US')) || ', deterministic = true);';
+  END
+$$;
 CREATE COLLATION ctest_nondet (locale = 'en_US', deterministic = false);