|  | 
|  | 1 | +#!/bin/sh | 
|  | 2 | + | 
|  | 3 | +## currently, this script makes a lot of assumptions: | 
|  | 4 | +## 1) location of guc.c and postgresql.conf.sample relative to script | 
|  | 5 | +##       For postgresql.conf.sample | 
|  | 6 | +## 2) the valid config settings may be preceded by a '#', but NOT '# ' | 
|  | 7 | +## 3) the valid config settings will be followed immediately by  ' ='  | 
|  | 8 | +##    (at least one space preceding the '=' | 
|  | 9 | +##       For guc.c | 
|  | 10 | +## 4) the options have PGC_ on the same line as the option | 
|  | 11 | +## 5) the options have '{ ' on the same line as the option | 
|  | 12 | + | 
|  | 13 | +##  Problems | 
|  | 14 | +## 1) Don't know what to do with TRANSACTION ISOLATION LEVEL | 
|  | 15 | + | 
|  | 16 | +## if an option is valid but shows up in only one file (guc.h or  | 
|  | 17 | +## postgresql.conf.sample, it should be listed here so that it  | 
|  | 18 | +## can be ignored | 
|  | 19 | +INTENTIONALLY_NOT_INCLUDED="pre_auth_delay lc_messages lc_monetary \ | 
|  | 20 | +lc_time lc_numeric fixbtree" | 
|  | 21 | + | 
|  | 22 | +#self_path stolen from pg_ctl | 
|  | 23 | +self_path=`echo "$0" | sed 's,/[^/]*$,,'`       # (dirname command is not portable) | 
|  | 24 | +PATH_TO_GUC="$self_path" | 
|  | 25 | + | 
|  | 26 | +### What options are listed in postgresql.conf.sample, but don't appear  | 
|  | 27 | +### in guc.h? | 
|  | 28 | + | 
|  | 29 | +# grab everything that looks like a setting and convert it to lower case | 
|  | 30 | +SETTINGS=`grep ' =' $PATH_TO_GUC/postgresql.conf.sample | grep -v '^# ' | \ | 
|  | 31 | +          sed -e 's/^#//' | awk '{print $1}'` | 
|  | 32 | +SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'` | 
|  | 33 | + | 
|  | 34 | +for i in $SETTINGS ; do  | 
|  | 35 | +  hidden=0 | 
|  | 36 | +  ## it sure would be nice to replace this with an sql "not in" statement | 
|  | 37 | +  for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do | 
|  | 38 | +    if [ "$i" = "$hidethis" ] ; then  | 
|  | 39 | +      hidden=1 | 
|  | 40 | +    fi | 
|  | 41 | +  done | 
|  | 42 | +  if [ "0" = "$hidden" ] ; then | 
|  | 43 | +    grep -i $i $PATH_TO_GUC/guc.c > /dev/null;  | 
|  | 44 | +    if [ ! $? = 0 ] ; then  | 
|  | 45 | +      echo "$i seems to be missing from guc.c";  | 
|  | 46 | +    fi;  | 
|  | 47 | +  fi | 
|  | 48 | +done | 
|  | 49 | + | 
|  | 50 | +### What options are listed in guc.h, but don't appear  | 
|  | 51 | +### in postgresql.conf.sample? | 
|  | 52 | + | 
|  | 53 | +# grab everything that looks like a setting and convert it to lower case | 
|  | 54 | + | 
|  | 55 | +SETTINGS=`grep '{ .*PGC_' $PATH_TO_GUC/guc.c | awk '{print $2}' | \ | 
|  | 56 | +          sed -e 's/"//g' -e 's/,//'` | 
|  | 57 | +SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'` | 
|  | 58 | + | 
|  | 59 | +for i in $SETTINGS ; do | 
|  | 60 | +  hidden=0 | 
|  | 61 | +  for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do | 
|  | 62 | +    if [ "$i" = "$hidethis" ] ; then | 
|  | 63 | +      hidden=1 | 
|  | 64 | +    fi | 
|  | 65 | +  done | 
|  | 66 | +  if [ "0" = "$hidden" ] ; then | 
|  | 67 | +    grep -i $i $PATH_TO_GUC/postgresql.conf.sample > /dev/null; | 
|  | 68 | +    if [ ! $? = 0 ] ; then | 
|  | 69 | +      echo "$i seems to be missing from postgresql.conf.sample"; | 
|  | 70 | +    fi | 
|  | 71 | +  fi | 
|  | 72 | +done | 
0 commit comments