28.12.2023 20:36, Jeff Davis wrote:
We do want that test to run though, right?

Yes, I think so.

I suspect that test line never worked reliably. The skip_test check at
the top guarantees that the collation named "en_US" exists, but that
doesn't mean that the OS understands the locale 'en_US'.

Perhaps we can change that line to use a similar trick as what's used
elsewhere in the file:

   do $$
   BEGIN
     EXECUTE 'CREATE COLLATION ctest_det (locale = ' ||
             quote_literal((SELECT collcollate FROM pg_collation WHERE
collname = ''en_US'')) || ', deterministic = true);';
   END
   $$;

The above may need some adjustment, but perhaps you can try it out?

Yes, this trick resolves the issue, it gives locale 'en-US' on that OS,
which works there. Please see the attached patch.

But looking at the result with the comment above that "do" block, I wonder
whether this successful CREATE COLLATION command is so important to perform
it that tricky way, if we want to demonstrate that nondeterministic
collations not supported.
So in case you decide just to remove this command, please see the second
patch.

Best regards,
Alexander
diff --git a/src/test/regress/expected/collate.windows.win1252.out b/src/test/regress/expected/collate.windows.win1252.out
index b7b93959de..bb6297a113 100644
--- a/src/test/regress/expected/collate.windows.win1252.out
+++ b/src/test/regress/expected/collate.windows.win1252.out
@@ -992,7 +992,6 @@ 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);
 CREATE COLLATION ctest_nondet (locale = 'en_US', deterministic = false);
 ERROR:  nondeterministic collations not supported with this provider
 -- cleanup
diff --git a/src/test/regress/sql/collate.windows.win1252.sql b/src/test/regress/sql/collate.windows.win1252.sql
index 353d769a5b..6246d89634 100644
--- a/src/test/regress/sql/collate.windows.win1252.sql
+++ b/src/test/regress/sql/collate.windows.win1252.sql
@@ -400,8 +400,6 @@ drop type textrange_en_us;
 
 -- nondeterministic collations
 -- (not supported with libc provider)
-
-CREATE COLLATION ctest_det (locale = 'en_US', deterministic = true);
 CREATE COLLATION ctest_nondet (locale = 'en_US', deterministic = false);
 
 
diff --git a/src/test/regress/expected/collate.windows.win1252.out b/src/test/regress/expected/collate.windows.win1252.out
index b7b93959de..97cbfc86de 100644
--- a/src/test/regress/expected/collate.windows.win1252.out
+++ b/src/test/regress/expected/collate.windows.win1252.out
@@ -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
diff --git a/src/test/regress/sql/collate.windows.win1252.sql b/src/test/regress/sql/collate.windows.win1252.sql
index 353d769a5b..727d136f2f 100644
--- a/src/test/regress/sql/collate.windows.win1252.sql
+++ b/src/test/regress/sql/collate.windows.win1252.sql
@@ -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);
 
 

Reply via email to