]> granicus.if.org Git - postgresql/blob - src/backend/utils/misc/check_guc
Improve the plan cache invalidation mechanism to make it invalidate plans
[postgresql] / src / backend / utils / misc / check_guc
1 #!/bin/sh
2
3 ## currently, this script makes a lot of assumptions:
4 ## in postgresql.conf.sample:
5 ##   1) the valid config settings may be preceded by a '#', but NOT '# '
6 ##      (we use this to skip comments)
7 ##   2) the valid config settings will be followed immediately by  ' =' 
8 ##      (at least one space preceding the '=')
9 ## in guc.c:
10 ##   3) the options have PGC_ on the same line as the option
11 ##   4) 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.c but not
17 ## postgresql.conf.sample), it should be listed here so that it 
18 ## can be ignored
19 INTENTIONALLY_NOT_INCLUDED="autocommit debug_deadlocks exit_on_error \
20 is_superuser lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time \
21 pre_auth_delay role seed server_encoding server_version server_version_int \
22 session_authorization trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks \
23 trace_notify trace_userlocks transaction_isolation transaction_read_only \
24 zero_damaged_pages"
25
26 ### What options are listed in postgresql.conf.sample, but don't appear 
27 ### in guc.c?
28
29 # grab everything that looks like a setting and convert it to lower case
30 SETTINGS=`grep ' =' postgresql.conf.sample | 
31 grep -v '^# ' | # strip comments
32 sed -e 's/^#//' | 
33 awk '{print $1}'`
34
35 SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'`
36
37 for i in $SETTINGS ; do 
38   hidden=0
39   ## it sure would be nice to replace this with an sql "not in" statement
40   ## it doesn't seem to make sense to have things in .sample and not in guc.c
41 #  for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do
42 #    if [ "$hidethis" = "$i" ] ; then 
43 #      hidden=1
44 #    fi
45 #  done
46   if [ "$hidden" -eq 0 ] ; then
47     grep -i '"'$i'"' guc.c > /dev/null
48     if [ $? -ne 0 ] ; then 
49       echo "$i seems to be missing from guc.c"; 
50     fi; 
51   fi
52 done
53
54 ### What options are listed in guc.c, but don't appear 
55 ### in postgresql.conf.sample?
56
57 # grab everything that looks like a setting and convert it to lower case
58
59 SETTINGS=`grep '{.* PGC_' guc.c | awk '{print $1}' | \
60           sed -e 's/{//g' -e 's/"//g' -e 's/,//'`
61
62 SETTINGS=`echo "$SETTINGS" | tr 'A-Z' 'a-z'`
63
64 for i in $SETTINGS ; do
65   hidden=0
66   ## it sure would be nice to replace this with an sql "not in" statement
67   for hidethis in $INTENTIONALLY_NOT_INCLUDED ; do
68     if [ "$hidethis" = "$i" ] ; then
69       hidden=1
70     fi
71   done
72   if [ "$hidden" -eq 0 ] ; then
73     grep -i '#'$i' ' postgresql.conf.sample > /dev/null
74     if [ $? -ne 0 ] ; then
75       echo "$i seems to be missing from postgresql.conf.sample";
76     fi
77   fi
78 done