I got tired of looking up regression_output/log/postmaster.log to find the PGSOCKET to use to connect to a running pg_regress ‘s temp-install postgres so I wrote a little shell function for it. My patch to print a connst in pg_regress never got merged so I needed a workaround.

I’m sure I’m not the only one, so here’s regress_psql for your convenience.

Pop it in your bashrc and invoke it from the directory you run make check in.

# Launch a psql against a running pg_regress instance # without messing around reading the logs. # function regress_psql() { pgpidf="tmp_check/data/postmaster.pid" if ! [ -e "$pgpidf" ] then echo "no postmaster.pid at $pgpidf" return 1 fi PGPORT="$(awk 'NR==4 { print $0; }' "$pgpidf")" PGHOST="$(awk 'NR==5 { print $0; }' "$pgpidf")" connstr="host='$PGHOST' port=$PGPORT dbname='postgres'" echo "connstr: \"$connstr\"" psql -v PROMPT1="%M:%> [%p] %[email protected]%/=%# " -v PROMPT2="%M:%> [%p] %[email protected]%/+%# " -q "$connstr" "[email protected]" }

Usage: