Alexander Korotkov wrote at 2025-07-28 20:04:
Hi, Oleg!

Thank you for raising this issue.  I don't think ignoring a warning is
an option.  The tests contain locale-sensitive orderings.  Thus, if we
don't manage to create a C-like locale, tests fail anyway for me.
Ignoring tests is an unfavorable solution.

I see two (better) options to resolve this issue:
1) Specify LOCALE_PROVIDER='builtin' in the CREATE DATABASE command.
2) Specify 'en-US-u-va-posix' as a locale name when template0 has an
ICU locale provider.

The #1 looks simpler.  The patch is attached.  What do you think?

------
Regards,
Alexander Korotkov
Supabase

Thanks for your response!

Your patch works with REL_17 & master, but not with REL_16, since there is no builtin provider

So if we're going that route, for PostgreSQL 16 and older we could just use libc provider instead of builtin for the same effect (see attached)

I've run installcheck-world for both 'builtin' and 'libc', both seem to work fine

Dunno what about tests like collate.icu.utf8.sql that require icu databases to run. Will those tests be run if we force non-icu locale providers in pg_regress? We probaly want them to be run sometimes, right? Except this, LGTM

Regards, Oleg Tselebrovskiy
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index b49ff7913a7..32c908ca6d1 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1973,10 +1973,10 @@ create_database(const char *dbname)
 	 */
 	if (encoding)
 		psql_add_command(buf, "CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'%s", dbname, encoding,
-						 (nolocale) ? " LOCALE='C'" : "");
+						 (nolocale) ? " LOCALE='C' LOCALE_PROVIDER='libc'" : "");
 	else
 		psql_add_command(buf, "CREATE DATABASE \"%s\" TEMPLATE=template0%s", dbname,
-						 (nolocale) ? " LOCALE='C'" : "");
+						 (nolocale) ? " LOCALE='C' LOCALE_PROVIDER='libc'" : "");
 	psql_add_command(buf,
 					 "ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
 					 "ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"

Reply via email to