mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
doc: Update CREATE DATABASE examples
The example of using CREATE DATABASE with the ENCODING option did not work anymore (except in special circumstances) and did not represent a good general-purpose example, so write some new examples. Reported-by: marc+pgsql@milestonerdl.com
This commit is contained in:
@ -284,17 +284,33 @@ CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
To create a database <literal>music</> which supports the ISO-8859-1
|
To create a database <literal>music</> with a different locale:
|
||||||
character set:
|
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
|
CREATE DATABASE music
|
||||||
|
LC_COLLATE 'sv_SE.utf8' LC_CTYPE 'sv_SE.utf8'
|
||||||
|
TEMPLATE template0;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
In this example, the <literal>TEMPLATE template0</> clause is required if
|
||||||
|
the specified locale is different from the one in <literal>template1</>.
|
||||||
|
(If it is not, then specifying the locale explicitly is redundant.)
|
||||||
|
</para>
|
||||||
|
|
||||||
In this example, the <literal>TEMPLATE template0</> clause would only
|
<para>
|
||||||
be required if <literal>template1</>'s encoding is not ISO-8859-1.
|
To create a database <literal>music2</> with a different locale and a
|
||||||
Note that changing encoding might require selecting new
|
different character set encoding:
|
||||||
<literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings as well.
|
<programlisting>
|
||||||
|
CREATE DATABASE music2
|
||||||
|
LC_COLLATE 'sv_SE.iso885915' LC_CTYPE 'sv_SE.iso885915'
|
||||||
|
ENCODING LATIN9
|
||||||
|
TEMPLATE template0;
|
||||||
|
</programlisting>
|
||||||
|
The specified locale and encoding settings must match, or an error will be
|
||||||
|
reported.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Note that locale names are specific to the operating system, so that the
|
||||||
|
above commands might not work in the same way everywhere.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user