pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: CREATE DATABASE: make LOCALE apply to all collation providers.
4+ messages / 3 participants
[nested] [flat]
* pgsql: CREATE DATABASE: make LOCALE apply to all collation providers.
@ 2023-06-16 17:41 Jeff Davis <jdavis@postgresql.org>
2023-06-16 20:14 ` Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <pgsql@j-davis.com>
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Davis @ 2023-06-16 17:41 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
CREATE DATABASE: make LOCALE apply to all collation providers.
For CREATE DATABASE, make LOCALE parameter apply regardless of the
provider used. Also affects initdb and createdb --locale arguments.
Previously, LOCALE (and --locale) only affected the database default
collation when using the libc provider.
Discussion: https://postgr.es/m/1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com
Reviewed-by: Peter Eisentraut
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a14e75eb0b6a73821e0d66c0d407372ec8376105
Modified Files
--------------
doc/src/sgml/ref/create_collation.sgml | 23 +++++++----
doc/src/sgml/ref/create_database.sgml | 57 ++++++++++++++++++++------
doc/src/sgml/ref/createdb.sgml | 5 ++-
doc/src/sgml/ref/initdb.sgml | 7 ++--
src/backend/commands/collationcmds.c | 2 +-
src/backend/commands/dbcommands.c | 17 +++++---
src/bin/initdb/initdb.c | 10 ++++-
src/bin/initdb/t/001_initdb.pl | 11 +++++
src/bin/scripts/createdb.c | 13 +++---
src/bin/scripts/t/020_createdb.pl | 15 +++++--
src/test/icu/t/010_database.pl | 33 +++++++++++----
src/test/regress/expected/collate.icu.utf8.out | 22 +++++-----
12 files changed, 155 insertions(+), 60 deletions(-)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers.
2023-06-16 17:41 pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <jdavis@postgresql.org>
@ 2023-06-16 20:14 ` Jeff Davis <pgsql@j-davis.com>
2023-06-16 22:06 ` Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Davis @ 2023-06-16 20:14 UTC (permalink / raw)
To: Jeff Davis <jdavis@postgresql.org>; pgsql-committers@lists.postgresql.org
On Fri, 2023-06-16 at 17:41 +0000, Jeff Davis wrote:
> CREATE DATABASE: make LOCALE apply to all collation providers.
This created a minor test diff for the test_extensions test for
cs_CZ.UTF-8:
https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=jay&dt=2023-06-16%2018%3A02%3A15&a...
https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=hippopotamus&dt=2023-06-16%2017%3A...
I believe the new behavior is correct, and the test is being run
incorrectly.
The buildfarm members do an initdb with the cs_CZ locale, and then run
the test_extensions test in installcheck mode against that
installation. As expected that creates \dx+ output using the cs_CZ
locale, which sorts "sequence" before "schema", unlike with the C
locale.
The test_extensions Makefile specifies NO_LOCALE=1 to avoid this kind
of problem, but that doesn't help during an installcheck.
Regards,
Jeff Davis
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers.
2023-06-16 17:41 pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <jdavis@postgresql.org>
2023-06-16 20:14 ` Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <pgsql@j-davis.com>
@ 2023-06-16 22:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-06-17 00:09 ` Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <pgsql@j-davis.com>
0 siblings, 1 reply; 4+ messages in thread
From: Tom Lane @ 2023-06-16 22:06 UTC (permalink / raw)
To: Jeff Davis <pgsql@j-davis.com>; +Cc: pgsql-committers@lists.postgresql.org
Jeff Davis <pgsql@j-davis.com> writes:
> This created a minor test diff for the test_extensions test for
> cs_CZ.UTF-8:
> https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=jay&dt=2023-06-16%2018%3A02%3A15&a...
> https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=hippopotamus&dt=2023-06-16%2017%3A...
> I believe the new behavior is correct, and the test is being run
> incorrectly.
You do not get to define that. The reason we have buildfarm members
running tests this way is exactly to flush out tests that are unduly
collation-sensitive. They will break in the field too.
You might have to provide an alternative expected-file for that test.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers.
2023-06-16 17:41 pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <jdavis@postgresql.org>
2023-06-16 20:14 ` Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <pgsql@j-davis.com>
2023-06-16 22:06 ` Re: pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Tom Lane <tgl@sss.pgh.pa.us>
@ 2023-06-17 00:09 ` Jeff Davis <pgsql@j-davis.com>
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Davis @ 2023-06-17 00:09 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, 2023-06-16 at 18:06 -0400, Tom Lane wrote:
> You do not get to define that. The reason we have buildfarm members
> running tests this way is exactly to flush out tests that are unduly
> collation-sensitive. They will break in the field too.
It looks like the actual problem is that, when pg_regress creates the
database in --no-locale mode, it passes LC_COLLATE='C' and
LC_CTYPE='C', instead of just LOCALE='C'.
Before my commit, the two were equivalent so it didn't matter, but
afterwards it created an inconsistency that left daticulocale as cs-CZ.
Patch attached.
Regards,
Jeff Davis
Attachments:
v1-0001-pg_regress-for-no-locale-use-LOCALE-C.patch (text/x-patch, 1.4K)
download | inline diff:
From 09cdcc04fe79ca9df80d1f499701bf34902b703f Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
Date: Fri, 16 Jun 2023 16:46:41 -0700
Subject: [PATCH v1] pg_regress: for --no-locale, use LOCALE='C'.
Instead of specifying LC_COLLATE='C' and LC_CTYPE='C', specify
LOCALE='C' which will also affect ICU. This makes pg_regress
consistent with recent changes to initdb in commit a14e75eb0b6.
Fixes buildfarm failure.
Discussion: https://postgr.es/m/2458565.1686953169@sss.pgh.pa.us
---
src/test/regress/pg_regress.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index a546fc3d34..60d34a40b2 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1972,10 +1972,10 @@ create_database(const char *dbname)
*/
if (encoding)
psql_add_command(buf, "CREATE DATABASE \"%s\" TEMPLATE=template0 ENCODING='%s'%s", dbname, encoding,
- (nolocale) ? " LC_COLLATE='C' LC_CTYPE='C'" : "");
+ (nolocale) ? " LOCALE='C'" : "");
else
psql_add_command(buf, "CREATE DATABASE \"%s\" TEMPLATE=template0%s", dbname,
- (nolocale) ? " LC_COLLATE='C' LC_CTYPE='C'" : "");
+ (nolocale) ? " LOCALE='C'" : "");
psql_add_command(buf,
"ALTER DATABASE \"%s\" SET lc_messages TO 'C';"
"ALTER DATABASE \"%s\" SET lc_monetary TO 'C';"
--
2.34.1
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2023-06-17 00:09 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-06-16 17:41 pgsql: CREATE DATABASE: make LOCALE apply to all collation providers. Jeff Davis <jdavis@postgresql.org>
2023-06-16 20:14 ` Jeff Davis <pgsql@j-davis.com>
2023-06-16 22:06 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-06-17 00:09 ` Jeff Davis <pgsql@j-davis.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox