Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 549f747

Browse files
committed
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
1 parent a593183 commit 549f747

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

doc/src/sgml/ref/create_database.sgml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,33 @@ CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
284284
</para>
285285

286286
<para>
287-
To create a database <literal>music</> which supports the ISO-8859-1
288-
character set:
287+
To create a database <literal>music</> with a different locale:
288+
<programlisting>
289+
CREATE DATABASE music
290+
LC_COLLATE 'sv_SE.utf8' LC_CTYPE 'sv_SE.utf8'
291+
TEMPLATE template0;
292+
</programlisting>
293+
In this example, the <literal>TEMPLATE template0</> clause is required if
294+
the specified locale is different from the one in <literal>template1</>.
295+
(If it is not, then specifying the locale explicitly is redundant.)
296+
</para>
289297

298+
<para>
299+
To create a database <literal>music2</> with a different locale and a
300+
different character set encoding:
290301
<programlisting>
291-
CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
302+
CREATE DATABASE music2
303+
LC_COLLATE 'sv_SE.iso885915' LC_CTYPE 'sv_SE.iso885915'
304+
ENCODING LATIN9
305+
TEMPLATE template0;
292306
</programlisting>
307+
The specified locale and encoding settings must match, or an error will be
308+
reported.
309+
</para>
293310

294-
In this example, the <literal>TEMPLATE template0</> clause would only
295-
be required if <literal>template1</>'s encoding is not ISO-8859-1.
296-
Note that changing encoding might require selecting new
297-
<literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings as well.
311+
<para>
312+
Note that locale names are specific to the operating system, so that the
313+
above commands might not work in the same way everywhere.
298314
</para>
299315
</refsect1>
300316

0 commit comments

Comments
 (0)