export PATH
PGDATA=`pwd`/cluster
export PGDATA
- PGHOST=`pwd`
- export PGHOST
PGPORT=$PG_PORT
export PGPORT
+ socket_dir=`mktemp -d`
+ PGHOST="$socket_dir"
+ export PGHOST
AT_CHECK([initdb -A trust], [0], [ignore])
- AT_CHECK([pg_ctl start -w -o "-k `pwd` -h ''"], [0], [ignore])
+ AT_CHECK([pg_ctl start -w -o "-k $socket_dir -h ''"], [0], [ignore])
trap 'CLEANUP_PSQL' 0
- AT_CHECK([createdb -h "`pwd`" -p $PG_PORT $PG_DBASE],
+ AT_CHECK([createdb -h "$socket_dir" -p $PG_PORT $PG_DBASE],
[0], [ignore], [ignore])
AT_DATA([populate.sql],
[CREATE TABLE empty (a int, b date, c numeric(23, 4));
'01:05:02 UTC-7'
);
])
- AT_CHECK([psql -h "`pwd`" -p $PG_PORT $PG_DBASE < populate.sql],
+ AT_CHECK([psql -h "$socket_dir" -p $PG_PORT $PG_DBASE < populate.sql],
[0], [ignore])])
-m4_define([CLEANUP_PSQL], [pg_ctl stop -W -o "-k `pwd` -h ''"])
+m4_define([CLEANUP_PSQL], [pg_ctl stop -W -o "-k $socket_dir -h ''"])
AT_SETUP([GET DATA /TYPE=PSQL])
INIT_PSQL
dnl Test with an ordinary query.
AT_CHECK([cat > ordinary-query.sps <<EOF
GET DATA /TYPE=psql
- /CONNECT="host=$PGHOST port=$PGPORT dbname=$PG_DBASE"
+ /CONNECT="host=$socket_dir port=$PGPORT dbname=$PG_DBASE"
/UNENCRYPTED
/SQL="select * from thing".
dnl Test query with empty result set.
AT_CHECK([cat > empty-result.sps <<EOF
GET DATA /TYPE=psql
- /CONNECT="host=$PGHOST port=$PGPORT dbname=$PG_DBASE"
+ /CONNECT="host=$socket_dir port=$PGPORT dbname=$PG_DBASE"
/UNENCRYPTED
/SQL="select * from empty".
dnl Test query with large result set.
AT_CHECK([cat > large-result.sps <<EOF
GET DATA /TYPE=psql
- /CONNECT="host=$PGHOST port=$PGPORT dbname=$PG_DBASE"
+ /CONNECT="host=$socket_dir port=$PGPORT dbname=$PG_DBASE"
/UNENCRYPTED
/SQL="select * from large".
INSERT INTO foo VALUES (null, '');
])
-AT_CHECK([psql -h "`pwd`" -p $PG_PORT $PG_DBASE < all-null-string.sql],
+AT_CHECK([psql -h "$socket_dir" -p $PG_PORT $PG_DBASE < all-null-string.sql],
[0], [ignore])
AT_CAPTURE_FILE([get-data.sps])
AT_CHECK([cat > get-data.sps <<EOF
GET DATA /TYPE=psql
- /CONNECT="host=$PGHOST port=$PGPORT dbname=$PG_DBASE"
+ /CONNECT="host=$socket_dir port=$PGPORT dbname=$PG_DBASE"
/UNENCRYPTED
/SQL="select * from foo".
])
AT_CHECK([pspp -o pspp.csv get-data.sps])
AT_CAPTURE_FILE([pspp.csv])
+rm -rf "$socket_dir"
AT_CLEANUP