@@ -86,30 +86,45 @@ PostgreSQL documentation
86
86
</para>
87
87
88
88
<para>
89
- <command>initdb</command> initializes the database cluster's default
90
- locale and character set encoding. The character set encoding,
91
- collation order (<literal>LC_COLLATE</literal>) and character set classes
92
- (<literal>LC_CTYPE</literal>, e.g., upper, lower, digit) can be set separately
93
- for a database when it is created. <command>initdb</command> determines
94
- those settings for the template databases, which will
95
- serve as the default for all other databases.
89
+ <command>initdb</command> initializes the database cluster's default locale
90
+ and character set encoding. These can also be set separately for each
91
+ database when it is created. <command>initdb</command> determines those
92
+ settings for the template databases, which will serve as the default for
93
+ all other databases. By default, <command>initdb</command> uses the
94
+ locale provider <literal>libc</literal>, takes the locale settings from
95
+ the environment, and determines the encoding from the locale settings.
96
+ This is almost always sufficient, unless there are special requirements.
96
97
</para>
97
98
98
99
<para>
99
- To alter the default collation order or character set classes , use the
100
- <option>--lc-collate </option> and <option>--lc-ctype</option> options.
101
- Collation orders other than <literal>C</literal> or <literal>POSIX</literal> also have
102
- a performance penalty . For these reasons it is important to choose the
103
- right locale when running <command>initdb</command> .
100
+ To choose a different locale for the cluster , use the option
101
+ <option>--locale </option>. There are also individual options
102
+ <option>--lc-*</option> (see below) to set values for the individual locale
103
+ categories . Note that inconsistent settings for different locale
104
+ categories can give nonsensical results, so this should be used with care .
104
105
</para>
105
106
106
107
<para>
107
- The remaining locale categories can be changed later when the server
108
- is started. You can also use <option>--locale</option> to set the
109
- default for all locale categories, including collation order and
110
- character set classes. All server locale values (<literal>lc_*</literal>) can
111
- be displayed via <command>SHOW ALL</command>.
112
- More details can be found in <xref linkend="locale"/>.
108
+ Alternatively, the ICU library can be used to provide locale services.
109
+ (Again, this only sets the default for subsequently created databases.) To
110
+ select this option, specify <literal>--locale-provider=icu</literal>.
111
+ To chose the specific ICU locale ID to apply, use the option
112
+ <option>--icu-locale</option>. Note that
113
+ for implementation reasons and to support legacy code,
114
+ <command>initdb</command> will still select and initialize libc locale
115
+ settings when the ICU locale provider is used.
116
+ </para>
117
+
118
+ <para>
119
+ When <command>initdb</command> runs, it will print out the locale settings
120
+ it has chosen. If you have complex requirements or specified multiple
121
+ options, it is advisable to check that the result matches what was
122
+ intended.
123
+ </para>
124
+
125
+ <para>
126
+ More details about locale settings can be found in <xref
127
+ linkend="locale"/>.
113
128
</para>
114
129
115
130
<para>
@@ -210,6 +225,15 @@ PostgreSQL documentation
210
225
</listitem>
211
226
</varlistentry>
212
227
228
+ <varlistentry>
229
+ <term><option>--icu-locale=<replaceable>locale</replaceable></option></term>
230
+ <listitem>
231
+ <para>
232
+ Specifies the ICU locale ID, if the ICU locale provider is used.
233
+ </para>
234
+ </listitem>
235
+ </varlistentry>
236
+
213
237
<varlistentry id="app-initdb-data-checksums" xreflabel="data checksums">
214
238
<term><option>-k</option></term>
215
239
<term><option>--data-checksums</option></term>
@@ -264,6 +288,18 @@ PostgreSQL documentation
264
288
</listitem>
265
289
</varlistentry>
266
290
291
+ <varlistentry>
292
+ <term><option>--locale-provider={<literal>libc</literal>|<literal>icu</literal>}</option></term>
293
+ <listitem>
294
+ <para>
295
+ This option sets the locale provider for databases created in the
296
+ new cluster. It can be overridden in the <command>CREATE
297
+ DATABASE</command> command when new databases are subsequently
298
+ created. The default is <literal>libc</literal>.
299
+ </para>
300
+ </listitem>
301
+ </varlistentry>
302
+
267
303
<varlistentry>
268
304
<term><option>-N</option></term>
269
305
<term><option>--no-sync</option></term>
0 commit comments