aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/check_guc
blob: 772ce49aae4864033224ad9add11736a3b3ad5cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh

## currently, this script makes a lot of assumptions:
## 1) the valid config settings may be preceded by a '#', but NOT '# '
##    (we use this to skip comments)
## 2) the valid config settings will be followed immediately by  ' =' 
##    (at least one space preceding the '=' for guc.c)
## 3) the options have PGC_ on the same line as the option
## 4) 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.c 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 fixbtree server_encoding session_authorization"

### What options are listed in postgresql.conf.sample, but don't appear 
### in guc.c?

# grab everything that looks like a setting and convert it to lower case
SETTINGS=`grep ' =' postgresql.conf.sample | 
grep -v '^# ' | # strip comments
sed -e 's/^#//' | 
awk '{print $1}'`

SETTINGS=`echo "$SETTINGS" | 
tr 'A-Z' 'a-z' # lowercase`

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 [ "$hidethis" = "$i" ] ; then 
      hidden=1
    fi
  done
  if [ "$hidden" -eq 0 ] ; then
    grep -i $i guc.c > /dev/null
    if [ $? -ne 0 ] ; then 
      echo "$i seems to be missing from guc.c"; 
    fi; 
  fi
done

### What options are listed in guc.c, but don't appear 
### in postgresql.conf.sample?

# grab everything that looks like a setting and convert it to lower case

SETTINGS=`grep '{ .*PGC_' 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 [ "$hidethis" = "$i" ] ; then
      hidden=1
    fi
  done
  if [ "$hidden" -eq 0 ] ; then
    grep -i $i postgresql.conf.sample > /dev/null
    if [ $? -ne 0 ] ; then
      echo "$i seems to be missing from postgresql.conf.sample";
    fi
  fi
done