~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to doc/src/sgml/ref/create_database.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-05-19 14:03:37 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090519140337-wp9u2si99uppeb81
Tags: 8.4~beta2-2
* Second public beta of 8.4.
* debian/control: Slightly lower the dependencies for postgresql-common to
  >= 98~, so that backports also match.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!--
2
 
$PostgreSQL$
 
2
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.52 2009/05/06 16:15:21 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
 
116
116
      </listitem>
117
117
     </varlistentry>
118
118
     <varlistentry>
119
 
      <term><replaceable class="parameter">collate</replaceable></term>
 
119
      <term><replaceable class="parameter">lc_collate</replaceable></term>
120
120
      <listitem>
121
121
       <para>
122
122
        Collation order (<literal>LC_COLLATE</>) to use in the new database.
123
 
        This affects the sort order applied to strings, e.g in queries with
 
123
        This affects the sort order applied to strings, e.g. in queries with
124
124
        ORDER BY, as well as the order used in indexes on text columns.
125
125
        The default is to use the collation order of the template database.
126
126
        See below for additional restrictions.
128
128
      </listitem>
129
129
     </varlistentry>
130
130
     <varlistentry>
131
 
      <term><replaceable class="parameter">ctype</replaceable></term>
 
131
      <term><replaceable class="parameter">lc_ctype</replaceable></term>
132
132
      <listitem>
133
133
       <para>
134
134
        Character classification (<literal>LC_CTYPE</>) to use in the new
207
207
 
208
208
  <para>
209
209
   The character set encoding specified for the new database must be
210
 
   compatible with the chosen LC_COLLATE and LC_CTYPE settings.
211
 
   If <envar>LC_CTYPE</> is <literal>C</> (or equivalently
 
210
   compatible with the chosen locale settings (<literal>LC_COLLATE</> and
 
211
   <literal>LC_CTYPE</>).  If the locale is <literal>C</> (or equivalently
212
212
   <literal>POSIX</>), then all encodings are allowed, but for other
213
213
   locale settings there is only one encoding that will work properly.
 
214
   (On Windows, however, UTF-8 encoding can be used with any locale.)
214
215
   <command>CREATE DATABASE</> will allow superusers to specify
215
 
   <literal>SQL_ASCII</> encoding regardless of the locale setting,
 
216
   <literal>SQL_ASCII</> encoding regardless of the locale settings,
216
217
   but this choice is deprecated and may result in misbehavior of
217
218
   character-string functions if data that is not encoding-compatible
218
219
   with the locale is stored in the database.
219
220
  </para>
220
221
 
221
222
  <para>
222
 
   The <literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings must match
223
 
   those of the template database, except when template0 is used as
224
 
   template. This is because <literal>LC_COLLATE</> and <literal>LC_CTYPE</>
225
 
   affects the ordering in indexes, so that any indexes copied from the
226
 
   template database would be invalid in the new database with different
227
 
   settings. <literal>template0</literal>, however, is known to not
228
 
   contain any indexes that would be affected.
 
223
   The encoding and locale settings must match those of the template database,
 
224
   except when <literal>template0</> is used as template.  This is because
 
225
   other databases might contain data that does not match the specified
 
226
   encoding, or might contain indexes whose sort ordering is affected by
 
227
   <literal>LC_COLLATE</> and <literal>LC_CTYPE</>.  Copying such data would
 
228
   result in a database that is corrupt according to the new settings.
 
229
   <literal>template0</literal>, however, is known to not contain any data or
 
230
   indexes that would be affected.
229
231
  </para>
230
232
 
231
233
  <para>
257
259
  </para>
258
260
 
259
261
  <para>
260
 
   To create a database <literal>music</> which supports the ISO-8859-1 
 
262
   To create a database <literal>music</> which supports the ISO-8859-1
261
263
   character set:
262
264
 
263
265
<programlisting>
264
 
CREATE DATABASE music ENCODING 'LATIN1';
 
266
CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
265
267
</programlisting>
 
268
 
 
269
   In this example, the <literal>TEMPLATE template0</> clause would only
 
270
   be required if <literal>template1</>'s encoding is not ISO-8859-1.
 
271
   Note that changing encoding might require selecting new
 
272
   <literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings as well.
266
273
  </para>
267
274
 </refsect1>
268
275