mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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
This commit is contained in:
@ -85,9 +85,16 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replace
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
This is a shortcut for setting <symbol>LC_COLLATE</symbol>
|
||||
and <symbol>LC_CTYPE</symbol> at once. If you specify this,
|
||||
you cannot specify either of those parameters.
|
||||
The locale name for this collation. See <xref
|
||||
linkend="collation-managing-create-libc"/> and <xref
|
||||
linkend="collation-managing-create-icu"/> for details.
|
||||
</para>
|
||||
<para>
|
||||
If <replaceable>provider</replaceable> is <literal>libc</literal>, this
|
||||
is a shortcut for setting <symbol>LC_COLLATE</symbol> and
|
||||
<symbol>LC_CTYPE</symbol> at once. If you specify
|
||||
<replaceable>locale</replaceable>, you cannot specify either of those
|
||||
parameters.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -97,8 +104,9 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replace
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Use the specified operating system locale for
|
||||
the <symbol>LC_COLLATE</symbol> locale category.
|
||||
If <replaceable>provider</replaceable> is <literal>libc</literal>, use
|
||||
the specified operating system locale for the
|
||||
<symbol>LC_COLLATE</symbol> locale category.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -108,8 +116,9 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replace
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Use the specified operating system locale for
|
||||
the <symbol>LC_CTYPE</symbol> locale category.
|
||||
If <replaceable>provider</replaceable> is <literal>libc</literal>, use
|
||||
the specified operating system locale for the <symbol>LC_CTYPE</symbol>
|
||||
locale category.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -145,8 +145,22 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
|
||||
<term><replaceable class="parameter">locale</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is a shortcut for setting <symbol>LC_COLLATE</symbol>
|
||||
and <symbol>LC_CTYPE</symbol> at once.
|
||||
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 <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
|
||||
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
|
||||
linkend="collation-managing-create-libc"/> and <xref
|
||||
linkend="collation-managing-create-icu"/> for details.
|
||||
</para>
|
||||
<para>
|
||||
Can be overridden by setting <xref
|
||||
linkend="create-database-lc-collate"/>, <xref
|
||||
linkend="create-database-lc-ctype"/>, or <xref
|
||||
linkend="create-database-icu-locale"/> individually.
|
||||
</para>
|
||||
<tip>
|
||||
<para>
|
||||
@ -164,11 +178,17 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
|
||||
<term><replaceable class="parameter">lc_collate</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Collation order (<literal>LC_COLLATE</literal>) to use in the new database.
|
||||
This affects the sort order applied to strings, e.g., in queries with
|
||||
ORDER BY, as well as the order used in indexes on text columns.
|
||||
The default is to use the collation order of the template database.
|
||||
See below for additional restrictions.
|
||||
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
|
||||
setting as the template database. See below for additional
|
||||
restrictions.
|
||||
</para>
|
||||
<para>
|
||||
If <xref linkend="create-database-locale-provider"/> is
|
||||
<literal>libc</literal>, also sets the default collation order to use
|
||||
in the new database, overriding the setting <xref
|
||||
linkend="create-database-locale"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -176,10 +196,17 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
|
||||
<term><replaceable class="parameter">lc_ctype</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Character classification (<literal>LC_CTYPE</literal>) to use in the new
|
||||
database. This affects the categorization of characters, e.g., lower,
|
||||
upper and digit. The default is to use the character classification of
|
||||
the template database. See below for additional restrictions.
|
||||
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
|
||||
setting as the template database. See below for additional
|
||||
restrictions.
|
||||
</para>
|
||||
<para>
|
||||
If <xref linkend="create-database-locale-provider"/> is
|
||||
<literal>libc</literal>, also sets the default character
|
||||
classification to use in the new database, overriding the setting
|
||||
<xref linkend="create-database-locale"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -188,7 +215,13 @@ CREATE DATABASE <replaceable class="parameter">name</replaceable>
|
||||
<term><replaceable class="parameter">icu_locale</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the ICU locale ID if the ICU locale provider is used.
|
||||
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 <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>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -124,7 +124,10 @@ PostgreSQL documentation
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies the locale to be used in this database. This is equivalent
|
||||
to specifying both <option>--lc-collate</option> and <option>--lc-ctype</option>.
|
||||
to specifying <option>--lc-collate</option>,
|
||||
<option>--lc-ctype</option>, and <option>--icu-locale</option> to the
|
||||
same value. Some locales are only valid for ICU and must be set with
|
||||
<option>--icu-locale</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -116,9 +116,10 @@ PostgreSQL documentation
|
||||
<para>
|
||||
To choose a different locale for the cluster, use the option
|
||||
<option>--locale</option>. There are also individual options
|
||||
<option>--lc-*</option> (see below) to set values for the individual locale
|
||||
categories. Note that inconsistent settings for different locale
|
||||
categories can give nonsensical results, so this should be used with care.
|
||||
<option>--lc-*</option> and <option>--icu-locale</option> (see below) to
|
||||
set values for the individual locale categories. Note that inconsistent
|
||||
settings for different locale categories can give nonsensical results, so
|
||||
this should be used with care.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user