diff --git a/test_pg.sh b/test_pg.sh index dab00d9392305f5d4a9844ff0b4fef669af332fb..9fcbcf3241f8fb901c95cdabe1cb3b15d5662761 100644 --- a/test_pg.sh +++ b/test_pg.sh @@ -2,6 +2,18 @@ set -eu +# Try to find a Postgres installation (Debian installs PG commands to their own dir) +if ! which pg_ctl >/dev/null 2>/dev/null; then + pg_path=$(echo /usr/lib/postgresql/*/bin | grep -vF '*' | head -1) + if [ -n "$pg_path" ]; then + echo "Using PostgreSQL from $pg_path" + export PATH="$pg_path:$PATH" + else + echo "WARNING: Unable to find pg_ctl, skipping PostgreSQL tests" + exit 0 + fi +fi + export PGHOST="$PWD/postgres_test" if [ $# -ge 1 ]; then PGHOST="$(realpath -- "$1")"