Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3a8cdf3

Browse files
committed
>> It certainly doesn't. There still was a bug with the locale stuff,
>> though - the GUC variable was not set in the child >processes. So "show >> lc_collate" would *always* return "C", for example. attached >patch fixes >> this. > >Hm. Why were these vars not propagated by the regular >mechanism for GUC >variables (write_nondefault_variables or whatever it's called)? If the >problem is that it's not accepting PGC_INTERNAL values, then we need to >fix it there not here, because otherwise we'll have to pass all the >PGC_INTERNAL variables through the backend_variables file, which seems >like a recipe for more of the same sort of bug. Good point :-( I think the problem is not only that it specifically does not deal with PGC_INTERNAL variables. The problem is in the fact that write_nondefault_variables is called *before* the locale is read (because the locale is read from pg_control and not from any of the "usual" ways to read it). Attached patch is another stab at fixing it. It makes postmaster dump a new copy of the file once it has started the database (before it accepts any connections), which is when it will know about these parameters. Also updates the reading code to set the context to the one where the variable was originally set (PGC_POSTMASTER won't work for PGC_INTERNAL, and the other way around). We still pass lc_collate through the special file, because set_config_option on lc_collate will speficially *not* call setlocale(), and we need that call. But we no longer call set_config_option from there. Magnus Hagander
1 parent a28d04e commit 3a8cdf3

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/backend/postmaster/postmaster.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.402 2004/06/03 02:08:03 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.403 2004/06/11 03:54:43 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -830,6 +830,10 @@ PostmasterMain(int argc, char *argv[])
830830
*/
831831
StartupPID = StartupDataBase();
832832

833+
#ifdef EXEC_BACKEND
834+
write_nondefault_variables(PGC_POSTMASTER);
835+
#endif
836+
833837
status = ServerLoop();
834838

835839
/*

src/backend/utils/misc/guc.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.210 2004/05/30 23:40:38 neilc Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.211 2004/06/11 03:54:54 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -4454,15 +4454,19 @@ read_nondefault_variables(void)
44544454

44554455
for (;;)
44564456
{
4457+
struct config_generic *record;
4458+
44574459
if ((varname = read_string_with_null(fp)) == NULL)
44584460
break;
44594461

4462+
if ((record = find_option(varname)) == NULL)
4463+
elog(FATAL, "failed to locate variable %s in exec config params file",varname);
44604464
if ((varvalue = read_string_with_null(fp)) == NULL)
44614465
elog(FATAL, "invalid format of exec config params file");
44624466
if (fread(&varsource, sizeof(varsource), 1, fp) == 0)
44634467
elog(FATAL, "invalid format of exec config params file");
44644468

4465-
(void) set_config_option(varname, varvalue, PGC_POSTMASTER,
4469+
(void) set_config_option(varname, varvalue, record->context,
44664470
varsource, false, true);
44674471
free(varname);
44684472
free(varvalue);

0 commit comments

Comments
 (0)