Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit867901d

Browse files
committed
Locale support is on by default. The choice of locale is done in initdb
and/or with GUC variables.
1 parent3d7755c commit867901d

File tree

19 files changed

+543
-468
lines changed

19 files changed

+543
-468
lines changed

‎configure

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,6 @@ if test -n "$ac_init_help"; then
845845
Optional Features:
846846
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
847847
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
848-
--enable-locale enable locale support
849848
--enable-recode enable character set recode support
850849
--enable-multibyte enable multibyte character support
851850
--enable-nls[=LANGUAGES] enable Native Language Support
@@ -1570,44 +1569,6 @@ fi;
15701569
15711570
15721571
1573-
#
1574-
# Locale (--enable-locale)
1575-
#
1576-
echo"$as_me:$LINENO: checking whether to build with locale support">&5
1577-
echo$ECHO_N"checking whether to build with locale support...$ECHO_C">&6
1578-
1579-
1580-
# Check whether --enable-locale or --disable-locale was given.
1581-
iftest"${enable_locale+set}" =set;then
1582-
enableval="$enable_locale"
1583-
1584-
case$enablevalin
1585-
yes)
1586-
1587-
cat>>confdefs.h<<\_ACEOF
1588-
#define USE_LOCALE 1
1589-
_ACEOF
1590-
1591-
;;
1592-
no)
1593-
:
1594-
;;
1595-
*)
1596-
{ {echo"$as_me:$LINENO: error: no argument expected for --enable-locale option">&5
1597-
echo"$as_me: error: no argument expected for --enable-locale option">&2;}
1598-
{ (exit 1);exit 1; }; }
1599-
;;
1600-
esac
1601-
1602-
else
1603-
enable_locale=no
1604-
1605-
fi;
1606-
1607-
echo"$as_me:$LINENO: result:$enable_locale">&5
1608-
echo"${ECHO_T}$enable_locale">&6
1609-
1610-
16111572
#
16121573
# Character set recode (--enable-recode)
16131574
#

‎configure.in

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.174 2002/04/01 01:11:00 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.175 2002/04/03 05:39:27 petere Exp $
33

44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -140,16 +140,6 @@ PGAC_ARG_REQ(with, libs, [ --with-libs=DIRS alternative spelling of
140140
[LIBRARY_DIRS=$withval])
141141

142142

143-
#
144-
# Locale (--enable-locale)
145-
#
146-
AC_MSG_CHECKING([whether to build with locale support])
147-
PGAC_ARG_BOOL(enable, locale, no, [ --enable-locale enable locale support],
148-
[AC_DEFINE([USE_LOCALE], 1,
149-
[Set to 1 if you want LOCALE support (--enable-locale)])])
150-
AC_MSG_RESULT([$enable_locale])
151-
152-
153143
#
154144
# Character set recode (--enable-recode)
155145
#

‎doc/src/sgml/charset.sgml

Lines changed: 75 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v 2.23 2002/03/22 19:20:05 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v 2.24 2002/04/03 05:39:27 petere Exp $ -->
22

33
<chapter id="charset">
44
<title>Localization</>
@@ -63,35 +63,24 @@
6363
<sect2>
6464
<title>Overview</>
6565

66-
<para>
67-
Locale support is not built into <productname>PostgreSQL</> by
68-
default; to enable it, supply the <option>--enable-locale</> option
69-
to the <filename>configure</> script:
70-
<informalexample>
66+
<para>
67+
Locale support is automatically initialized when a database
68+
cluster is created using <command>initdb</command>.
69+
<command>initdb</command> will initialize the database cluster
70+
with the locale setting of its execution environment; so if your
71+
system is already set to use the locale that you want in your
72+
database cluster then there is nothing else you need to do. If
73+
you want to use a different locale (or you are not sure which
74+
locale your system is set to), you can tell
75+
<command>initdb</command> exactly which locale you want with the
76+
option <option>--locale</option>. For example:
7177
<screen>
72-
<prompt>$ </><userinput>./configure --enable-locale</>
78+
<prompt>$ </><userinput>initdb --locale=sv_SE</>
7379
</screen>
74-
</informalexample>
75-
Locale support only affects the server; all clients are compatible
76-
with servers with or without locale support.
77-
</para>
78-
79-
<para>
80-
To enable messages translated to the user's preferred language,
81-
the <option>--enable-nls</option> option must be used. This
82-
option is independent of the other locale support.
8380
</para>
8481

8582
<para>
86-
The information about which particular cultural rules to use is
87-
determined by standard environment variables. If you are getting
88-
localized behavior from other programs you probably have them set
89-
up already. The simplest way to set the localization information
90-
is the <envar>LANG</> variable, for example:
91-
<programlisting>
92-
export LANG=sv_SE
93-
</programlisting>
94-
This sets the locale to Swedish (<literal>sv</>) as spoken in
83+
This example sets the locale to Swedish (<literal>sv</>) as spoken in
9584
Sweden (<literal>SE</>). Other possibilities might be
9685
<literal>en_US</> (U.S. English) and <literal>fr_CA</> (Canada,
9786
French). If more than one character set can be useful for a locale
@@ -103,9 +92,9 @@ export LANG=sv_SE
10392

10493
<para>
10594
Occasionally it is useful to mix rules from several locales, e.g.,
106-
use U.S. collation rules but Spanish messages. Todo that a set of
107-
environment variablesexist thatoverride the default of
108-
<envar>LANG</> for a particular category:
95+
use U.S. collation rules but Spanish messages. Tosupport that, a
96+
set of locale subcategoriesexist thatcontrol only a certain
97+
aspect of the localization rules.
10998

11099
<informaltable>
111100
<tgroup cols="2">
@@ -138,49 +127,79 @@ export LANG=sv_SE
138127
</tgroup>
139128
</informaltable>
140129

141-
Additionally, all of these specific variables and the
142-
<envar>LANG</> variable can be overridden with the
143-
<envar>LC_ALL</> environment variable.
130+
The category names translate into names of
131+
<command>initdb</command> options to override the locale choice
132+
for a specific category. For instance, to set the locale to
133+
French Canadian, but use U.S. rules for formatting currency, use
134+
<literal>initdb --locale=fr_CA --lc-monetary=en_US</literal>.
144135
</para>
145136

146-
<note>
147-
<para>
148-
Some message localization libraries also look at the environment
149-
variable <envar>LANGUAGE</envar> which overrides all other locale
150-
settings for the purpose of setting the language of messages. If
151-
in doubt, please refer to the documentation of your operating
152-
system, in particular the
153-
<citerefentry><refentrytitle>gettext</><manvolnum>3</></> manual
154-
page, for more information.
155-
</para>
156-
</note>
157-
158137
<para>
159138
If you want the system to behave as if it had no locale support,
160-
use the special locale <literal>C</> or <literal>POSIX</>, or
161-
simply unset all locale-related variables.
139+
use the special locale <literal>C</> or <literal>POSIX</>.
140+
</para>
141+
142+
<para>
143+
The nature of some locale categories is that their value has to be
144+
fixed for the lifetime of a database cluster. That is, once
145+
<command>initdb</command> has run, you cannot change them anymore.
146+
<literal>LC_COLLATE</literal> and <literal>LC_CTYPE</literal> are
147+
those categories. They affect the sort order of indexes, so they
148+
must be kept fixed, or indexes on text columns will become corrupt.
149+
<productname>PostgreSQL</productname> enforces this by recording
150+
the values of <envar>LC_COLLATE</> and <envar>LC_CTYPE</> that are
151+
seen by <command>initdb</>. The server automatically adopts
152+
those two values when it is started.
153+
</para>
154+
155+
<para>
156+
The other locale categories can be changed as desired whenever the
157+
server is started by setting the run-time configuration variables
158+
that have the same name as the locale categories (see <xref
159+
linkend="runtime-config"> for details). The defaults that are
160+
chosen by <command>initdb</command> are actually only written into
161+
the configuration file <filename>postgresql.conf</filename> to
162+
serve as defaults when the server is started. If you delete the
163+
assignments from <filename>postgresql.conf</filename> then the
164+
server will inherit the settings from the execution environment.
162165
</para>
163166

164167
<para>
165168
Note that the locale behavior of the server is determined by the
166169
environment variables seen by the server, not by the environment
167-
of any client. Therefore, be careful toset these variables
170+
of any client. Therefore, be careful toconfigure the correct locale settings
168171
before starting the server. A consequence of this is that if
169172
client and server are set up to different locales, messages may
170173
appear in different languages depending on where they originated.
171174
</para>
172175

176+
<note>
177+
<para>
178+
When we speak of inheriting the locale from the execution
179+
environment, this means the following on most operating systems:
180+
For a given locale category, say the collation, the following
181+
environment variables are consulted in this order until one is
182+
found to be set: <envar>LC_ALL</envar>, <envar>LC_COLLATE</envar>
183+
(the variable corresponding to the respective category),
184+
<envar>LANG</envar>. If none of these environment variables are
185+
set then the locale defaults to <literal>C</literal>.
186+
</para>
187+
188+
<para>
189+
Some message localization libraries also look at the environment
190+
variable <envar>LANGUAGE</envar> which overrides all other locale
191+
settings for the purpose of setting the language of messages. If
192+
in doubt, please refer to the documentation of your operating
193+
system, in particular the
194+
<citerefentry><refentrytitle>gettext</><manvolnum>3</></> manual
195+
page, for more information.
196+
</para>
197+
</note>
198+
173199
<para>
174-
The <envar>LC_COLLATE</> and <envar>LC_CTYPE</> variables affect the
175-
sort order of indexes. Therefore, these values must be kept fixed
176-
for any particular database cluster, or indexes on text columns will
177-
become corrupt. <productname>PostgreSQL</productname> enforces this
178-
by recording the values of <envar>LC_COLLATE</> and <envar>LC_CTYPE</>
179-
that are seen by <application>initdb</>. The server automatically adopts
180-
those two values when it is started; only the other <envar>LC_</>
181-
categories can be set from the environment at server start-up.
182-
In short, only one collation order can be used in a database cluster,
183-
and it is chosen at <application>initdb</> time.
200+
To enable messages translated to the user's preferred language,
201+
the <option>--enable-nls</option> option must be used. This
202+
option is independent of the other locale support.
184203
</para>
185204
</sect2>
186205

‎doc/src/sgml/datatype.sgml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.86 2002/03/22 19:20:07 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.87 2002/04/03 05:39:27 petere Exp $
33
-->
44

55
<chapter id="datatype">
@@ -724,11 +724,9 @@ CREATE TABLE <replaceable class="parameter">tablename</replaceable> (<replaceabl
724724
</note>
725725

726726
<para>
727-
The <type>money</type> type stores U.S.-style currency with fixed
728-
decimal point representation. If
729-
<productname>PostgreSQL</productname> is compiled with locale
730-
support then the <type>money</type> type uses locale-specific
731-
output formatting.
727+
The <type>money</type> type stores a currency amount with fixed
728+
decimal point representation. The output format is
729+
locale-specific.
732730
</para>
733731

734732
<para>

‎doc/src/sgml/installation.sgml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.74 2002/01/20 05:45:18 tgl Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.75 2002/04/03 05:39:28 petere Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -531,17 +531,6 @@ su - postgres
531531
</listitem>
532532
</varlistentry>
533533

534-
<varlistentry>
535-
<term><option>--enable-locale</option></term>
536-
<listitem>
537-
<para>
538-
Enables locale support. There is a performance penalty
539-
associated with locale support, but if you are not in an
540-
English-speaking environment you will most likely need this.
541-
</para>
542-
</listitem>
543-
</varlistentry>
544-
545534
<varlistentry>
546535
<term><option>--enable-recode</option></term>
547536
<listitem>

‎doc/src/sgml/ref/initdb.sgml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.19 2001/12/08 03:24:37 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/initdb.sgml,v 1.20 2002/04/03 05:39:29 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -38,6 +38,13 @@ PostgreSQL documentation
3838
<arg>-E </arg>
3939
<replaceable>encoding</replaceable>
4040
</group>
41+
<arg>--locale <replaceable>locale</replaceable></arg>
42+
<arg>--lc-collate <replaceable>locale</replaceable></arg>
43+
<arg>--lc-ctype <replaceable>locale</replaceable></arg>
44+
<arg>--lc-messages <replaceable>locale</replaceable></arg>
45+
<arg>--lc-monetary <replaceable>locale</replaceable></arg>
46+
<arg>--lc-numeric <replaceable>locale</replaceable></arg>
47+
<arg>--lc-time <replaceable>locale</replaceable></arg>
4148
<arg>-L <replaceable>directory</replaceable></arg>
4249
<group><arg>--noclean</arg><arg>-n</arg></group>
4350
<group><arg>--debug</arg><arg>-d</arg></group>
@@ -66,6 +73,25 @@ PostgreSQL documentation
6673
built-in types.
6774
</para>
6875

76+
<para>
77+
<command>initdb</command> initializes the database cluster's
78+
default locale and character set encoding. Some locale categories
79+
are fixed for the lifetime of the cluster, so it is important to
80+
make the right choice when running <command>initdb</command>.
81+
Other locale categories can be changed later when the server is
82+
started. <command>initdb</command> will write those locale
83+
settings into the <filename>postgresql.conf</filename>
84+
configuration file so they are the default, but they can be changed
85+
by editing that file. To set the locale that
86+
<command>initdb</command> uses, see the description of the
87+
<option>--locale</option> option. The character set encoding can
88+
be set separately for each database as it is created.
89+
<command>initdb</command> determines the encoding for the
90+
<literal>template1</literal> database, which will serve as the
91+
default for all other databases. To alter the default encoding use
92+
the <option>--encoding</option> option.
93+
</para>
94+
6995
<para>
7096
<command>initdb</command> must be run as the user that will own the
7197
server process, because the server needs to have access to the
@@ -150,6 +176,32 @@ PostgreSQL documentation
150176
</listitem>
151177
</varlistentry>
152178

179+
<varlistentry>
180+
<term>--locale=<replaceable>locale</replaceable></term>
181+
<listitem>
182+
<para>
183+
Sets the default locale for the database cluster. If this
184+
option is not specified, the locale is inherited from the
185+
environment that <command>initdb</command> runs in.
186+
</para>
187+
</listitem>
188+
</varlistentry>
189+
190+
<varlistentry>
191+
<term>--lc-collate=<replaceable>locale</replaceable></term>
192+
<term>--lc-ctype=<replaceable>locale</replaceable></term>
193+
<term>--lc-messages=<replaceable>locale</replaceable></term>
194+
<term>--lc-monetary=<replaceable>locale</replaceable></term>
195+
<term>--lc-numeric=<replaceable>locale</replaceable></term>
196+
<term>--lc-time=<replaceable>locale</replaceable></term>
197+
198+
<listitem>
199+
<para>
200+
Like <option>--locale</option>, but only sets the locale in
201+
the specified category.
202+
</para>
203+
</listitem>
204+
</varlistentry>
153205
</variablelist>
154206
</para>
155207

‎doc/src/sgml/release.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.129 2002/04/01 04:35:37 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.130 2002/04/03 05:39:28 petere Exp $
33
-->
44

55
<appendix id="release">
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
2424
worries about funny characters.
2525
-->
2626
<literallayout><![CDATA[
27+
Locale support is now built by default; choice of locale is set by initdb and/or at run-time
2728
ALTER TABLE ALTER COLUMN SET/DROP NOT NULL
2829
EXPLAIN output comes out as a query result, not a NOTICE message
2930
DOMAINs (types that are constrained versions of base types)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp