From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Marko Kreen <marko(at)l-t(dot)ee> |
Cc: | <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: reset all update |
Date: | 2001-06-12 19:37:43 |
Message-ID: | Pine.LNX.4.30.0106122128400.756-100000@peter.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Marko Kreen writes:
> * GUCify command line arguments.
> * ResetAllOptions() comment
> * split set_config_option()
> * use set_config_option_real() on string reset
> - it calls hooks and free()'s the previous val
> * check if string val changed on reset
Seems on track. Comments below.
> Index: src/backend/tcop/postgres.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/postgres.c,v
> retrieving revision 1.219
> diff -u -c -r1.219 postgres.c
> *** src/backend/tcop/postgres.c 2001/06/07 04:50:57 1.219
> --- src/backend/tcop/postgres.c 2001/06/11 09:17:07
> ***************
> *** 1108,1113 ****
> --- 1108,1115 ----
> const char *DBName = NULL;
> bool secure = true;
> int errs = 0;
> + GucContext ctx;
> + char *tmp;
>
> int firstchar;
> StringInfo parser_input;
> ***************
> *** 1117,1122 ****
> --- 1119,1126 ----
>
> char *potential_DataDir = NULL;
>
> + ctx = IsUnderPostmaster ? PGC_BACKEND : PGC_POSTMASTER;
> +
This is wrong. If you're in PostgresMain then the context is PGC_BACKEND
-- by definition.
> /*
> * Catch standard options before doing much else. This even works on
> * systems without getopt_long.
> ***************
> Index: src/backend/utils/misc/guc.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
> retrieving revision 1.37
> diff -u -c -r1.37 guc.c
> *** src/backend/utils/misc/guc.c 2001/06/07 04:50:57 1.37
> --- src/backend/utils/misc/guc.c 2001/06/11 09:17:09
> ***************
> --- 437,459 ----
> for (i = 0; ConfigureNamesString[i].name; i++)
> {
> char *str = NULL;
> + struct config_string *cf = &ConfigureNamesString[i];
>
> ! if (!cf->default_val && cf->boot_default_val)
> {
> ! str = strdup(cf->boot_default_val);
> if (str == NULL)
> elog(ERROR, "out of memory");
>
> ! cf->default_val = str;
> }
> !
> ! if (!cf->variable || !cf->default_val)
> ! continue;
This shouldn't happen. Just let it crash.
> !
> ! if (!*cf->variable || strcmp(cf->default_val, *cf->variable))
Evil coding style alert. Suggest:
if (*cf->variable == NULL || strcmp(cf->default_val, *cf->variable) != 0)
> ! set_config_option_real(PGC_STRING, (struct config_generic *)cf,
> ! cf->default_val, true, false, ERROR);
> }
>
> if (getenv("PGPORT"))
> ***************
--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2001-06-12 20:02:52 | Re: Patch to include PAM support... |
Previous Message | Tom Lane | 2001-06-12 19:07:34 | Re: Patch to include PAM support... |