port=6543
dbase=pspptest
-PG_CONFIG=pg_config
-pgpath=`$PG_CONFIG | awk '/BINDIR/{print $3}'`
+PG_CONFIG=${PG_CONFIG:=pg_config}
+pgpath=`$PG_CONFIG --bindir`
cleanup()
{
return ;
fi
PGHOST=$TEMPDIR $pgpath/pg_ctl -D $TEMPDIR/cluster stop -W -o "-k $TEMPDIR -h ''" > /dev/null 2>&1
+ cd /
rm -rf $TEMPDIR
}
activity="create database"
-createdb -h $TEMPDIR -p $port $dbase > /dev/null 2> /dev/null
+$pgpath/createdb -h $TEMPDIR -p $port $dbase > /dev/null 2> /dev/null
+if [ $? -ne 0 ] ; then no_result ; fi
activity="populate database"
-psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF
+$pgpath/psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF
CREATE TABLE empty (a int, b date, c numeric(23, 4));
EOF
if [ $? -ne 0 ] ; then fail ; fi
+
+
+# Check for a bug caused by having string variables in the database,
+# all of which are null.
+
+activity="populate database 4"
+$pgpath/psql -h $TEMPDIR -p $port $dbase > /dev/null << EOF
+
+-- a table which has a text field containing only null, or zero
+-- length entries.
+
+CREATE TABLE foo (int4 int4, text text);
+
+INSERT INTO foo VALUES ('12', '');
+
+INSERT INTO foo VALUES (null, '');
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="create program 4"
+cat > $TESTFILE <<EOF
+GET DATA /TYPE=psql
+ /CONNECT="host=$TEMPDIR port=$port dbname=$dbase"
+ /UNENCRYPTED
+ /SQL="select * from foo".
+
+DISPLAY DICTIONARY.
+
+LIST.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program 4"
+$SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
pass;