Skip site navigation (1) Skip section navigation (2)

Re: script to check consistency between guc.h and postgresql.conf.sample

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Ron Snyder <snyder(at)roguewave(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: script to check consistency between guc.h and postgresql.conf.sample
Date: 2002-08-27 03:04:59
Message-ID: 200208270304.g7R34x603280@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Added to backends/utils/misc as check_guc.  In fact, it shows:
	
	(3) check_guc
	fixbtree 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

There are all OK, I think, so I added them to the ski list.

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

Ron Snyder wrote:
> This script will ignore options that are listed in the 
> INTENTIONALLY_NOT_INCLUDED variable.
> 
> It expects to live in src/tools, but should be ok to move as long
> as PATH_TO_GUC is updated.
> 
> Here's what it complains about right now:
> 
> fixbtree 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 don't know if those things should be ignored or not.
> 
> -ron
> 
> #!/bin/sh
> 
> ## currently, this script makes a lot of assumptions:
> ## 1) location of guc.c and postgresql.conf.sample relative to script
> ##       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
> 
> ## if an option is valid but shows up in only one file (guc.h or 
> ## postgresql.conf.sample, it should be listed here so that it 
> ## can be ignored
> INTENTIONALLY_NOT_INCLUDED="pre_auth_delay lc_messages lc_monetary \
> lc_time lc_numeric"
> 
> #self_path stolen from pg_ctl
> self_path=`echo "$0" | sed 's,/[^/]*$,,'`       # (dirname command is not portable)
> PATH_TO_GUC="$self_path/../backend/utils/misc"
> 
> ### What options are listed in postgresql.conf.sample, but don't appear 
> ### in guc.h?
> 
> # grab everything that looks like a setting and convert it to lower case
> SETTINGS=`grep ' =' $PATH_TO_GUC/postgresql.conf.sample | grep -v '^# ' | \
>           sed -e 's/^#//' | awk '{print $1}'`
> SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'`
> 
> for i in $SETTINGS ; do 
>   hidden=0
>   ## it sure would be nice to replace this with an sql "not in" statement
>   for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do
>     if [ "$i" == "$hidethis" ] ; then 
>       hidden=1
>     fi
>   done
>   if [ "0" == "$hidden" ] ; then
>     grep -i $i $PATH_TO_GUC/guc.c > /dev/null; 
>     if [ ! $? = 0 ] ; then 
>       echo "$i seems to be missing from guc.c"; 
>     fi; 
>   fi
> done
> 
> ### What options are listed in guc.h, but don't appear 
> ### in postgresql.conf.sample?
> 
> # grab everything that looks like a setting and convert it to lower case
> 
> SETTINGS=`grep '{ .*PGC_' $PATH_TO_GUC/guc.c | awk '{print $2}' | \
>           sed -e 's/"//g' -e 's/,//'`
> SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'`
> 
> for i in $SETTINGS ; do
>   hidden=0
>   for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do
>     if [ "$i" == "$hidethis" ] ; then
>       hidden=1
>     fi
>   done
>   if [ "0" == "$hidden" ] ; then
>     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
>   fi
> done
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-patches by date

Next:From: Bruce MomjianDate: 2002-08-27 03:55:43
Subject: Re: indisclustered and clusterdb
Previous:From: Nigel J. AndrewsDate: 2002-08-26 22:58:00
Subject: Re: [HACKERS] TODO Done. Superuser backend slot reservations

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group