Re: reset all update - Mailing list pgsql-patches

From Marko Kreen
Subject Re: reset all update
Date
Msg-id 20010612224728.A29235@l-t.ee
Whole thread Raw
In response to reset all update  (Marko Kreen <marko@l-t.ee>)
Responses Re: reset all update
List pgsql-patches
On Tue, Jun 12, 2001 at 10:05:29PM +0200, Peter Eisentraut wrote:
> Marko Kreen writes:
>
> > On Tue, Jun 12, 2001 at 09:37:43PM +0200, Peter Eisentraut wrote:
> > > Marko Kreen writes:
> > > > *** src/backend/tcop/postgres.c    2001/06/07 04:50:57    1.219
> > > > --- src/backend/tcop/postgres.c    2001/06/11 09:17:07
> > > > +     ctx = IsUnderPostmaster ? PGC_BACKEND : PGC_POSTMASTER;
> > > > +
> > >
> > > This is wrong.  If you're in PostgresMain then the context is PGC_BACKEND
> > > -- by definition.
> >
> > Well, but how do you explain this: (line 1463 in current CVS):
> >
> >          /* all options are allowed if not under postmaster */
> >          SetConfigOption(name, value,
> >             (IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER, true);
> >
> > As I understand, when you run ./postgres directly, you get
> > PGC_POSTMASTER, which includes PGC_BACKEND.
>
> You're right.  Objection withdrawn.  ;-)

:)

The following should be applied on top of previous patch.
Moved the comment too.

--
marko


*** src/backend/tcop/postgres.c.orig    Tue Jun 12 21:53:26 2001
--- src/backend/tcop/postgres.c    Tue Jun 12 22:07:42 2001
***************
*** 1119,1124 ****
--- 1119,1125 ----

      char       *potential_DataDir = NULL;

+     /* all options are allowed if not under postmaster */
      ctx = IsUnderPostmaster ? PGC_BACKEND : PGC_POSTMASTER;

      /*
***************
*** 1465,1473 ****
                              elog(ERROR, "-c %s requires argument", optarg);
                      }

!                     /* all options are allowed if not under postmaster */
!                     SetConfigOption(name, value,
!                      (IsUnderPostmaster) ? PGC_BACKEND : PGC_POSTMASTER, true);
                      free(name);
                      if (value)
                          free(value);
--- 1466,1472 ----
                              elog(ERROR, "-c %s requires argument", optarg);
                      }

!                     SetConfigOption(name, value, ctx, true);
                      free(name);
                      if (value)
                          free(value);
*** src/backend/utils/misc/guc.c.orig    Tue Jun 12 21:50:51 2001
--- src/backend/utils/misc/guc.c    Tue Jun 12 22:19:23 2001
***************
*** 448,457 ****
              cf->default_val = str;
          }

!         if (!cf->variable || !cf->default_val)
!             continue;
!
!         if (!*cf->variable || strcmp(cf->default_val, *cf->variable))
              set_config_option_real(PGC_STRING, (struct config_generic *)cf,
                      cf->default_val, true, false, ERROR);
      }
--- 448,454 ----
              cf->default_val = str;
          }

!         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);
      }

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Australian timezone configure option
Next
From: Tom Lane
Date:
Subject: Re: Patch to include PAM support...