mirror of
https://github.com/postgres/postgres.git
synced 2025-08-18 12:22:09 +03:00
Make LC_COLLATE and LC_CTYPE database-level settings. Collation and
ctype are now more like encoding, stored in new datcollate and datctype columns in pg_database. This is a stripped-down version of Radek Strnad's patch, with further changes by me.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.48 2007/09/28 22:25:49 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.49 2008/09/23 09:20:34 heikki Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -24,6 +24,8 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
[ [ WITH ] [ OWNER [=] <replaceable class="parameter">dbowner</replaceable> ]
|
||||
[ TEMPLATE [=] <replaceable class="parameter">template</replaceable> ]
|
||||
[ ENCODING [=] <replaceable class="parameter">encoding</replaceable> ]
|
||||
[ COLLATE [=] <replaceable class="parameter">collate</replaceable> ]
|
||||
[ CTYPE [=] <replaceable class="parameter">ctype</replaceable> ]
|
||||
[ TABLESPACE [=] <replaceable class="parameter">tablespace</replaceable> ]
|
||||
[ CONNECTION LIMIT [=] <replaceable class="parameter">connlimit</replaceable> ] ]
|
||||
</synopsis>
|
||||
@@ -112,6 +114,29 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">collate</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Collation order (<literal>LC_COLLATE</>) 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.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">ctype</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Character classification (<literal>LC_CTYPE</>) 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.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">tablespace</replaceable></term>
|
||||
<listitem>
|
||||
@@ -180,13 +205,11 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Any character set encoding specified for the new database must be
|
||||
compatible with the server's <envar>LC_CTYPE</> locale setting.
|
||||
The character set encoding specified for the new database must be
|
||||
compatible with the chosen COLLATE and CTYPE settings.
|
||||
If <envar>LC_CTYPE</> is <literal>C</> (or equivalently
|
||||
<literal>POSIX</>), then all encodings are allowed, but for other
|
||||
locale settings there is only one encoding that will work properly,
|
||||
and so the apparent freedom to specify an encoding is illusory if
|
||||
you didn't initialize the database cluster in <literal>C</> locale.
|
||||
locale settings there is only one encoding that will work properly.
|
||||
<command>CREATE DATABASE</> will allow superusers to specify
|
||||
<literal>SQL_ASCII</> encoding regardless of the locale setting,
|
||||
but this choice is deprecated and may result in misbehavior of
|
||||
@@ -194,6 +217,16 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
with the locale is stored in the database.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <literal>COLLATE</> and <literal>CTYPE</> settings must match
|
||||
those of the template database, except when template0 is used as
|
||||
template. This is because <literal>COLLATE</> and <literal>CTYPE</>
|
||||
affects the ordering in indexes, so that any indexes copied from the
|
||||
template database would be invalid in the new database with different
|
||||
settings. <literal>template0</literal>, however, is known to not
|
||||
contain any indexes that would be affected.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The <literal>CONNECTION LIMIT</> option is only enforced approximately;
|
||||
if two new sessions start at about the same time when just one
|
||||
|
Reference in New Issue
Block a user