Thread: guc.c and postgresql.conf.sample constistency checker

guc.c and postgresql.conf.sample constistency checker

From
snyder@roguewave.com
Date:
This is a small script to check that guc.c and postgresql.conf.sample
are fairly representative of each other, and the output that I'm getting
against the most recent cvs.

The fix for debug_level is easy enough (I know it was removed from guc.c),
but I don't know enough about the rest of the items to be able to document
them in the postgresql.conf.sample well.

output:
debug_level seems to be missing from guc.c
fixbtree seems to be missing from postgresql.conf.sample
pre_auth_delay seems to be missing from postgresql.conf.sample
lc_messages seems to be missing from postgresql.conf.sample
lc_monetary seems to be missing from postgresql.conf.sample
lc_numeric seems to be missing from postgresql.conf.sample
lc_time seems to be missing from postgresql.conf.sample
server_encoding seems to be missing from postgresql.conf.sample
session_authorization seems to be missing from postgresql.conf.sample

I believe this script should live in src/tools
#!/bin/sh

## currently, this script makes a lot of assumptions:
## 1) location of guc.c and postgresql.conf.sample relative to src/tools
##       For postgresql.conf.sample
## 2) the valid config settings may be preceded by a '#', but NOT '# '
## 3) the valid config settings will be followed immediately by  ' ='
##    (at least one space preceding the '='
##       For guc.c
## 4) the options have PGC_ on the same line as the option
## 5) the options have '{ ' on the same line as the option

##  Problems
## 1) Don't know what to do with TRANSACTION ISOLATION LEVEL (in guc.c)

PATH_TO_GUC="`dirname $0`/../backend/utils/misc"

SETTINGS=`grep ' =' $PATH_TO_GUC/postgresql.conf.sample | grep -v '^# ' | sed -e 's,^#,,' | awk '{print $1}'`
for i in $SETTINGS ; do
  grep -i $i $PATH_TO_GUC/guc.c > /dev/null;
  if [ ! $? = 0 ] ; then
    echo "$i seems to be missing from guc.c";
  fi;
done

SETTINGS=`grep '{ .*PGC_' $PATH_TO_GUC/guc.c | awk '{print $2}' | sed -e 's,",,g' -e 's/,//'`
for i in $SETTINGS ; do
  grep -i $i $PATH_TO_GUC/postgresql.conf.sample > /dev/null;
  if [ ! $? = 0 ] ; then
    echo "$i seems to be missing from postgresql.conf.sample";
  fi;
done


Re: guc.c and postgresql.conf.sample constistency checker

From
Peter Eisentraut
Date:
snyder@roguewave.com writes:

> This is a small script to check that guc.c and postgresql.conf.sample
> are fairly representative of each other, and the output that I'm getting
> against the most recent cvs.

The catch is that some of these options (lc_*) are supposed to be absent,
so it's not as easy as it seems.

--
Peter Eisentraut   peter_e@gmx.net


Re: guc.c and postgresql.conf.sample constistency checker

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


snyder@roguewave.com wrote:
> This is a small script to check that guc.c and postgresql.conf.sample
> are fairly representative of each other, and the output that I'm getting
> against the most recent cvs.
>
> The fix for debug_level is easy enough (I know it was removed from guc.c),
> but I don't know enough about the rest of the items to be able to document
> them in the postgresql.conf.sample well.
>
> output:
> debug_level seems to be missing from guc.c
> fixbtree seems to be missing from postgresql.conf.sample
> pre_auth_delay seems to be missing from postgresql.conf.sample
> lc_messages seems to be missing from postgresql.conf.sample
> lc_monetary seems to be missing from postgresql.conf.sample
> lc_numeric seems to be missing from postgresql.conf.sample
> lc_time seems to be missing from postgresql.conf.sample
> server_encoding seems to be missing from postgresql.conf.sample
> session_authorization seems to be missing from postgresql.conf.sample
>
> I believe this script should live in src/tools
> #!/bin/sh
>
> ## currently, this script makes a lot of assumptions:
> ## 1) location of guc.c and postgresql.conf.sample relative to src/tools
> ##       For postgresql.conf.sample
> ## 2) the valid config settings may be preceded by a '#', but NOT '# '
> ## 3) the valid config settings will be followed immediately by  ' ='
> ##    (at least one space preceding the '='
> ##       For guc.c
> ## 4) the options have PGC_ on the same line as the option
> ## 5) the options have '{ ' on the same line as the option
>
> ##  Problems
> ## 1) Don't know what to do with TRANSACTION ISOLATION LEVEL (in guc.c)
>
> PATH_TO_GUC="`dirname $0`/../backend/utils/misc"
>
> SETTINGS=`grep ' =' $PATH_TO_GUC/postgresql.conf.sample | grep -v '^# ' | sed -e 's,^#,,' | awk '{print $1}'`
> for i in $SETTINGS ; do
>   grep -i $i $PATH_TO_GUC/guc.c > /dev/null;
>   if [ ! $? = 0 ] ; then
>     echo "$i seems to be missing from guc.c";
>   fi;
> done
>
> SETTINGS=`grep '{ .*PGC_' $PATH_TO_GUC/guc.c | awk '{print $2}' | sed -e 's,",,g' -e 's/,//'`
> for i in $SETTINGS ; do
>   grep -i $i $PATH_TO_GUC/postgresql.conf.sample > /dev/null;
>   if [ ! $? = 0 ] ; then
>     echo "$i seems to be missing from postgresql.conf.sample";
>   fi;
> done
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: guc.c and postgresql.conf.sample constistency checker

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Your patch has been added to the PostgreSQL unapplied patches list at:
>     http://candle.pha.pa.us/cgi-bin/pgpatches
> I will try to apply it within the next 48 hours.

See subsequent objections from Peter and me.  We could use something
like this, but it needs to be smarter.

            regards, tom lane

Re: guc.c and postgresql.conf.sample constistency checker

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Your patch has been added to the PostgreSQL unapplied patches list at:
> >     http://candle.pha.pa.us/cgi-bin/pgpatches
> > I will try to apply it within the next 48 hours.
>
> See subsequent objections from Peter and me.  We could use something
> like this, but it needs to be smarter.

Sorry I missed the objections.  I will not apply the script.

What about the comments he makes about the missing postgresql.conf
entries.  Do those need fixing?

    debug_level seems to be missing from guc.c
    fixbtree seems to be missing from postgresql.conf.sample
    pre_auth_delay seems to be missing from postgresql.conf.sample
    lc_messages seems to be missing from postgresql.conf.sample
    lc_monetary seems to be missing from postgresql.conf.sample
    lc_numeric seems to be missing from postgresql.conf.sample
    lc_time seems to be missing from postgresql.conf.sample
    server_encoding seems to be missing from postgresql.conf.sample
    session_authorization seems to be missing from postgresql.conf.sample

debug_level is removed from postgresql.conf already, replaced by
client/server_min_messages.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: guc.c and postgresql.conf.sample constistency checker

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> What about the comments he makes about the missing postgresql.conf
> entries.  Do those need fixing?

No (with the exception of debug_level which you got already).

            regards, tom lane