]> granicus.if.org Git - postgresql/commitdiff
>> It certainly doesn't. There still was a bug with the locale stuff,
authorBruce Momjian <bruce@momjian.us>
Fri, 11 Jun 2004 03:54:54 +0000 (03:54 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 11 Jun 2004 03:54:54 +0000 (03:54 +0000)
>> 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

src/backend/postmaster/postmaster.c
src/backend/utils/misc/guc.c

index 85ba8309d4b66790bd6fdad666db0c287c38415f..2081eb3650e39681f18099243cf06d9029ae504e 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.402 2004/06/03 02:08:03 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.403 2004/06/11 03:54:43 momjian Exp $
  *
  * NOTES
  *
@@ -830,6 +830,10 @@ PostmasterMain(int argc, char *argv[])
         */
        StartupPID = StartupDataBase();
 
+#ifdef EXEC_BACKEND
+       write_nondefault_variables(PGC_POSTMASTER);
+#endif
+
        status = ServerLoop();
 
        /*
index 8f1e7084c5957d048198bc59f26eb10ab1c166eb..f050e201e2a097f495351de516334d07a7883249 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.210 2004/05/30 23:40:38 neilc Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.211 2004/06/11 03:54:54 momjian Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -4454,15 +4454,19 @@ read_nondefault_variables(void)
 
        for (;;)
        {
+               struct config_generic *record;
+
                if ((varname = read_string_with_null(fp)) == NULL)
                        break;
 
+               if ((record = find_option(varname)) == NULL)
+                       elog(FATAL, "failed to locate variable %s in exec config params file",varname);
                if ((varvalue = read_string_with_null(fp)) == NULL)
                        elog(FATAL, "invalid format of exec config params file");
                if (fread(&varsource, sizeof(varsource), 1, fp) == 0)
                        elog(FATAL, "invalid format of exec config params file");
 
-               (void) set_config_option(varname, varvalue, PGC_POSTMASTER,
+               (void) set_config_option(varname, varvalue, record->context,
                                                                 varsource, false, true);
                free(varname);
                free(varvalue);