m4_define([INIT_PSQL],
[AT_SKIP_IF([test "$PSQL_SUPPORT" = no])
- PATH=$PG_PATH:$PATH
- export PATH
PGDATA=`pwd`/cluster
export PGDATA
PGPORT=$PG_PORT
socket_dir=`mktemp -d`
PGHOST="$socket_dir"
export PGHOST
- AT_CHECK([initdb -A trust], [0], [ignore])
- AT_CHECK([pg_ctl start -w -o "-k $socket_dir -h ''"], [0], [ignore])
+ AT_CHECK([PATH=$PG_PATH:$PATH initdb -A trust], [0], [ignore])
+ AT_CHECK([PATH=$PG_PATH:$PATH pg_ctl start -w -o "-k $socket_dir -h ''"], [0], [ignore])
trap 'CLEANUP_PSQL' 0
- AT_CHECK([createdb -h "$socket_dir" -p $PG_PORT $PG_DBASE],
+ AT_CHECK([PATH=$PG_PATH:$PATH 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'
);
])
+
+ # On Debian, the psql binary in the postgres bindir won't work because
+ # it needs libreadline to be LD_PRELOADed into it. The psql in the
+ # normal $PATH works fine though.
+ if (PATH=$PG_PATH:$PATH psql -V) >/dev/null 2>&1; then
+ psql () {
+ PATH=$PG_PATH:$PATH command psql "$@"
+ }
+ fi
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 $socket_dir -h ''"])
+m4_define([CLEANUP_PSQL], [PATH=$PG_PATH:$PATH pg_ctl stop -W -o "-k $socket_dir -h ''"])
AT_SETUP([GET DATA /TYPE=PSQL])
INIT_PSQL