Skip to content

Commit ba33775

Browse files
committed
Restore initdb's old behavior of always setting the lc_xxx GUCs.
In commit 3e51b27 I (tgl) caused initdb to leave lc_messages and other lc_xxx GUCs commented-out in the installed postgresql.conf file if they were going to be set to 'C'. This was a hack for cosmetic purposes, and it was buggy because lc_messages' wired-in default is not 'C' but '' (empty string). That led to --no-locale not having the expected effect, since the postmaster would then obtain lc_messages from its startup environment. Let's just revert to the prior behavior of always de-commenting the lc_xxx entries; the argument for changing that longstanding behavior was weak in the first place. Also, fix postgresql.conf.sample's erroneous claim that the default value of lc_messages is 'C'. I suspect that was what misled me into making this mistake in the first place. Report and patch by Kyotaro Horiguchi. Back-patch to v16 where the problem was introduced. Discussion: https://postgr.es/m/20231122.162700.1995154567625541112.horikyota.ntt@gmail.com
1 parent ee95532 commit ba33775

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@
728728
# encoding
729729

730730
# These settings are initialized by initdb, but they can be changed.
731-
#lc_messages = 'C' # locale for system error message
731+
#lc_messages = '' # locale for system error message
732732
# strings
733733
#lc_monetary = 'C' # locale for monetary formatting
734734
#lc_numeric = 'C' # locale for number formatting

src/bin/initdb/initdb.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,25 +1223,17 @@ setup_config(void)
12231223
conflines = replace_guc_value(conflines, "shared_buffers",
12241224
repltok, false);
12251225

1226-
/*
1227-
* Hack: don't replace the LC_XXX GUCs when their value is 'C', because
1228-
* replace_guc_value will decide not to quote that, which looks strange.
1229-
*/
1230-
if (strcmp(lc_messages, "C") != 0)
1231-
conflines = replace_guc_value(conflines, "lc_messages",
1232-
lc_messages, false);
1226+
conflines = replace_guc_value(conflines, "lc_messages",
1227+
lc_messages, false);
12331228

1234-
if (strcmp(lc_monetary, "C") != 0)
1235-
conflines = replace_guc_value(conflines, "lc_monetary",
1236-
lc_monetary, false);
1229+
conflines = replace_guc_value(conflines, "lc_monetary",
1230+
lc_monetary, false);
12371231

1238-
if (strcmp(lc_numeric, "C") != 0)
1239-
conflines = replace_guc_value(conflines, "lc_numeric",
1240-
lc_numeric, false);
1232+
conflines = replace_guc_value(conflines, "lc_numeric",
1233+
lc_numeric, false);
12411234

1242-
if (strcmp(lc_time, "C") != 0)
1243-
conflines = replace_guc_value(conflines, "lc_time",
1244-
lc_time, false);
1235+
conflines = replace_guc_value(conflines, "lc_time",
1236+
lc_time, false);
12451237

12461238
switch (locale_date_order(lc_time))
12471239
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy