From 0cd2154f364999091aba52136a139df75f58d1b7 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 16 Jun 2023 16:46:36 +0200 Subject: [PATCH] fixup! CREATE DATABASE: make LOCALE apply to all collation providers. --- doc/src/sgml/ref/create_database.sgml | 12 ++++++------ src/test/icu/t/010_database.pl | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml index dab05950ed..b2c8aef1ad 100644 --- a/doc/src/sgml/ref/create_database.sgml +++ b/doc/src/sgml/ref/create_database.sgml @@ -147,9 +147,9 @@ Parameters Sets the default collation order and character classification in the new database. Collation affects the sort order applied to strings, - e.g., in queries with ORDER BY, as well as the order used in indexes + e.g., in queries with ORDER BY, as well as the order used in indexes on text columns. Character classification affects the categorization - of characters, e.g., lower, - upper and digit. Also sets the + of characters, e.g., lower, upper, and digit. Also sets the associated aspects of the operating system environment, LC_COLLATE and LC_CTYPE. The default is the same setting as the template database. See Parameters Sets LC_COLLATE in the database server's operating system environment. The default is the setting of if specified; otherwise the same + linkend="create-database-locale"/> if specified, otherwise the same setting as the template database. See below for additional restrictions. @@ -198,7 +198,7 @@ Parameters Sets LC_CTYPE in the database server's operating system environment. The default is the setting of if specified; otherwise the same + linkend="create-database-locale"/> if specified, otherwise the same setting as the template database. See below for additional restrictions. @@ -218,8 +218,8 @@ Parameters Specifies the ICU locale (see ) for the database default collation order and character classification, overriding the setting - . The must be ICU. The default + . The locale provider must be ICU. The default is the setting of if specified; otherwise the same setting as the template database. diff --git a/src/test/icu/t/010_database.pl b/src/test/icu/t/010_database.pl index b417b1a409..cbe5467f3c 100644 --- a/src/test/icu/t/010_database.pl +++ b/src/test/icu/t/010_database.pl @@ -52,27 +52,30 @@ # Test that LOCALE='C' works for ICU -my $ret1 = $node1->psql('postgres', - q{CREATE DATABASE dbicu1 LOCALE_PROVIDER icu LOCALE 'C' TEMPLATE template0 ENCODING UTF8} -); -is($ret1, 0, +is( $node1->psql( + 'postgres', + q{CREATE DATABASE dbicu1 LOCALE_PROVIDER icu LOCALE 'C' TEMPLATE template0 ENCODING UTF8} + ), + 0, "C locale works for ICU"); # Test that LOCALE works for ICU locales if LC_COLLATE and LC_CTYPE # are specified -my $ret2 = $node1->psql('postgres', - q{CREATE DATABASE dbicu2 LOCALE_PROVIDER icu LOCALE '@colStrength=primary' +is( $node1->psql( + 'postgres', + q{CREATE DATABASE dbicu2 LOCALE_PROVIDER icu LOCALE '@colStrength=primary' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE template0 ENCODING UTF8} -); -is($ret2, 0, + ), + 0, "LOCALE works for ICU locales if LC_COLLATE and LC_CTYPE are specified"); # Test that ICU-specific LOCALE without LC_COLLATE and LC_CTYPE must # be specified with ICU_LOCALE -my ($ret3, $stdout, $stderr) = $node1->psql('postgres', +my ($ret, $stdout, $stderr) = $node1->psql( + 'postgres', q{CREATE DATABASE dbicu3 LOCALE_PROVIDER icu LOCALE '@colStrength=primary' TEMPLATE template0 ENCODING UTF8}); -isnt($ret3, 0, +isnt($ret, 0, "ICU-specific locale must be specified with ICU_LOCALE: exit code not 0"); like( $stderr, -- 2.41.0