#! /bin/sh

PATH=/usr/ucb:/bin:/usr/bin:$POSTGRESHOME/bin

COPY=`pwd`/copy$$

trap "rm -f $COPY" 2

datab=${1:-geo}

echo Creating geo_regexps in database $datab

cat > $COPY << \EOF
700	\\(+\\|-\\)?[0-9]*\\(\\.[0-9]+\\)?\\([eE]\\(+\\|-\\)?[0-9]+\\)?
701	\\(+\\|-\\)?[0-9]*\\(\\.[0-9]+\\)?\\([eE]\\(+\\|-\\)?[0-9]+\\)?
21	\\(+\\|-\\)?[0-9]+
23	\\(+\\|-\\)?[0-9]+
26	[0-9]+
30	[0-9]+
19	.?.?.?.?.?.?.?.?.?.?.?.?.?.?.?.?
16	\\(t\\(rue\\)?\\|f\\(alse\\)?\\)
600	(\\(+\\|-\\)?[0-9]+\\(\\.[0-9]+\\)?\\([eE]\\(+\\|-\\)?[0-9]+\\)?,\\(+\\|-\\)?[0-9]+\\(\\.[0-9]+\\)?\\([eE]\\(+\\|-\\)?[0-9]+\\)?)
col1.geo_color	[0-9][0-9]?
EOF

monitor $datab << EOF

destroy geo_regexp \g

create geo_regexp (type_id= text, regexp= text) \g

copy geo_regexp from "$COPY" \g
EOF

rm $COPY
