pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Jeff Davis <pgsql@j-davis.com>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Joe Conway <mail@joeconway.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Daniel Verite <daniel@manitou-mail.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Order changes in PG16 since ICU introduction
Date: Fri, 16 Jun 2023 16:50:34 +0200
Message-ID: <1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com> (raw)
In-Reply-To: <0bc3c34bf9f60f4f10ce048146b6728c12a9d4a1.camel@j-davis.com>
References: <45f0cd77-9c85-4c5e-9396-adbccdb635e2@manitou-mail.org>
	<f8d09d8f3d53daa9cdb446d021fe33d6ff7f1ee3.camel@j-davis.com>
	<ab925f69-5f9d-f85e-b87c-bd2a44798659@joeconway.com>
	<221408.1686079526@sss.pgh.pa.us>
	<CA+Tgmob-XgUgGrDx4sEMS3t0AQFgpm4KZgRuCd58bY+TsUO1tQ@mail.gmail.com>
	<225170.1686081345@sss.pgh.pa.us>
	<531936a9-31cb-9734-5a66-7c210133cc1b@joeconway.com>
	<87sfb4gwgv.fsf@news-spur.riddles.org.uk>
	<73f97db9a37fd281bd5077ce16383cd8006b1f59.camel@j-davis.com>
	<78ac19e5-c5c3-c739-3080-ad7ef604df8d@enterprisedb.com>
	<0bc3c34bf9f60f4f10ce048146b6728c12a9d4a1.camel@j-davis.com>

On 14.06.23 23:24, Jeff Davis wrote:
> On Mon, 2023-06-12 at 23:04 +0200, Peter Eisentraut wrote:
>>> Patch 0003:
>>>
>>> Makes LOCALE apply to all providers. The overall feel after this
>>> patch
>>> is that "locale" now means the collation locale, and
>>> LC_COLLATE/LC_CTYPE are for the server environment. When using
>>> libc,
>>> LC_COLLATE and LC_CTYPE still work as they did before, but their
>>> relationship to database collation feels more like a special case
>>> of
>>> the libc provider. I believe most people favor this patch and I
>>> haven't
>>> seen recent objections.
>>
>> This seems reasonable.
> 
> Attached a clean patch for this.
> 
> It seems to have widespread agreement so I plan to commit to v16 soon.
> 
> To clarify, this affects both initdb and CREATE DATABASE.

This looks good to me.

Attached is small fixup patch with some documentation tweaks and 
simplifying some test code (also includes pgperltidy).

Attachments:

0001-fixup-CREATE-DATABASE-make-LOCALE-apply-to-all-colla.patch (text/plain, 4.5K) download From 0cd2154f364999091aba52136a139df75f58d1b7 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <peter@eisentraut.org> 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 @@ <title>Parameters</title> <para> 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 <literal>ORDER BY</literal>, 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, <literal>LC_COLLATE</literal> and <literal>LC_CTYPE</literal>. The default is the same setting as the template database. See <xref @@ -180,7 +180,7 @@ <title>Parameters</title> <para> Sets <literal>LC_COLLATE</literal> in the database server's operating system environment. The default is the setting of <xref - linkend="create-database-locale"/> if specified; otherwise the same + linkend="create-database-locale"/> if specified, otherwise the same setting as the template database. See below for additional restrictions. </para> @@ -198,7 +198,7 @@ <title>Parameters</title> <para> Sets <literal>LC_CTYPE</literal> in the database server's operating system environment. The default is the setting of <xref - linkend="create-database-locale"/> if specified; otherwise the same + linkend="create-database-locale"/> if specified, otherwise the same setting as the template database. See below for additional restrictions. </para> @@ -218,8 +218,8 @@ <title>Parameters</title> Specifies the ICU locale (see <xref linkend="collation-managing-create-icu"/>) for the database default collation order and character classification, overriding the setting - <xref linkend="create-database-locale"/>. The <xref - linkend="create-database-locale-provider"/> must be ICU. The default + <xref linkend="create-database-locale"/>. The <link + linkend="create-database-locale-provider">locale provider</link> must be ICU. The default is the setting of <xref linkend="create-database-locale"/> if specified; otherwise the same setting as the template database. </para> 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

view thread (115+ messages)  latest in thread

Message-ID: <1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com>
Permalink:  ../1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com/
Also on:    postgresql.org/message-id/1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, pgsql@j-davis.com, andrew@tao11.riddles.org.uk, mail@joeconway.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, daniel@manitou-mail.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Order changes in PG16 since ICU introduction
  In-Reply-To: <1a63084d-221e-4075-619e-6b3e590f673e@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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