Skip to content

Commit 3d185cf

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 390298f commit 3d185cf

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
@@ -734,7 +734,7 @@
734734
# encoding
735735

736736
# These settings are initialized by initdb, but they can be changed.
737-
#lc_messages = 'C' # locale for system error message
737+
#lc_messages = '' # locale for system error message
738738
# strings
739739
#lc_monetary = 'C' # locale for monetary formatting
740740
#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
@@ -1227,25 +1227,17 @@ setup_config(void)
12271227
conflines = replace_guc_value(conflines, "shared_buffers",
12281228
repltok, false);
12291229

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

1238-
if (strcmp(lc_monetary, "C") != 0)
1239-
conflines = replace_guc_value(conflines, "lc_monetary",
1240-
lc_monetary, false);
1233+
conflines = replace_guc_value(conflines, "lc_monetary",
1234+
lc_monetary, false);
12411235

1242-
if (strcmp(lc_numeric, "C") != 0)
1243-
conflines = replace_guc_value(conflines, "lc_numeric",
1244-
lc_numeric, false);
1236+
conflines = replace_guc_value(conflines, "lc_numeric",
1237+
lc_numeric, false);
12451238

1246-
if (strcmp(lc_time, "C") != 0)
1247-
conflines = replace_guc_value(conflines, "lc_time",
1248-
lc_time, false);
1239+
conflines = replace_guc_value(conflines, "lc_time",
1240+
lc_time, false);
12491241

12501242
switch (locale_date_order(lc_time))
12511243
{

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