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