public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
Subject: [PATCH] doc: Update CREATE DATABASE examples
Date: Thu, 2 Feb 2017 14:57:46 -0500

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: [email protected]
---
 doc/src/sgml/ref/create_database.sgml | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml
index cf0d53b301..48386a29f9 100644
--- a/doc/src/sgml/ref/create_database.sgml
+++ b/doc/src/sgml/ref/create_database.sgml
@@ -284,17 +284,33 @@ <title>Examples</title>
   </para>
 
   <para>
-   To create a database <literal>music</> which supports the ISO-8859-1
-   character set:
+   To create a database <literal>music</> with a different locale:
+<programlisting>
+CREATE DATABASE music
+    LC_COLLATE 'sv_SE.utf8' LC_CTYPE 'sv_SE.utf8'
+    TEMPLATE template0;
+</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>
 
+  <para>
+   To create a database <literal>music2</> with a different locale and a
+   different character set encoding:
 <programlisting>
-CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
+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>
 
-   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>
+   Note that locale names are specific to the operating system, so that the
+   above commands might not work in the same way everywhere.
   </para>
  </refsect1>
 
-- 
2.11.0


--------------E820FE3A380D190A139975E2
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

--------------E820FE3A380D190A139975E2--





reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH] doc: Update CREATE DATABASE examples
  In-Reply-To: <no-message-id-2626@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox