diff options
Diffstat (limited to 'doc/src/sgml/ref/create_database.sgml')
-rw-r--r-- | doc/src/sgml/ref/create_database.sgml | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml index 5866ca7ef5c..786a63b7020 100644 --- a/doc/src/sgml/ref/create_database.sgml +++ b/doc/src/sgml/ref/create_database.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.51 2009/04/06 08:42:52 heikki Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.52 2009/05/06 16:15:21 tgl Exp $ PostgreSQL documentation --> @@ -116,11 +116,11 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> </listitem> </varlistentry> <varlistentry> - <term><replaceable class="parameter">collate</replaceable></term> + <term><replaceable class="parameter">lc_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 + 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. @@ -128,7 +128,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> </listitem> </varlistentry> <varlistentry> - <term><replaceable class="parameter">ctype</replaceable></term> + <term><replaceable class="parameter">lc_ctype</replaceable></term> <listitem> <para> Character classification (<literal>LC_CTYPE</>) to use in the new @@ -207,25 +207,27 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable> <para> The character set encoding specified for the new database must be - compatible with the chosen LC_COLLATE and LC_CTYPE settings. - If <envar>LC_CTYPE</> is <literal>C</> (or equivalently + compatible with the chosen locale settings (<literal>LC_COLLATE</> and + <literal>LC_CTYPE</>). If the locale 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. + (On Windows, however, UTF-8 encoding can be used with any locale.) <command>CREATE DATABASE</> will allow superusers to specify - <literal>SQL_ASCII</> encoding regardless of the locale setting, + <literal>SQL_ASCII</> encoding regardless of the locale settings, but this choice is deprecated and may result in misbehavior of character-string functions if data that is not encoding-compatible with the locale is stored in the database. </para> <para> - The <literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings must match - those of the template database, except when template0 is used as - template. This is because <literal>LC_COLLATE</> and <literal>LC_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. + The encoding and locale settings must match those of the template database, + except when <literal>template0</> is used as template. This is because + other databases might contain data that does not match the specified + encoding, or might contain indexes whose sort ordering is affected by + <literal>LC_COLLATE</> and <literal>LC_CTYPE</>. Copying such data would + result in a database that is corrupt according to the new settings. + <literal>template0</literal>, however, is known to not contain any data or + indexes that would be affected. </para> <para> @@ -257,12 +259,17 @@ CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace; </para> <para> - To create a database <literal>music</> which supports the ISO-8859-1 + To create a database <literal>music</> which supports the ISO-8859-1 character set: <programlisting> -CREATE DATABASE music ENCODING 'LATIN1'; +CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0; </programlisting> + + In this example, the <literal>TEMPLATE template0</> clause would only + be required if <literal>template1</>'s encoding is not ISO-8859-1. + Note that changing encoding might require selecting new + <literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings as well. </para> </refsect1> |