Closed
Description
It took me some time to discover that a syntax error was being not being reported by node.safe_psql(filename='some.sql')
. I tracked it down to behavior in psql
. It seems worth raising, though I'm not certain it is something that testgres is necessarily responsible for handling.
$ psql --version
psql (PostgreSQL) 9.6.4
and/or
$ psql --version
psql (PostgreSQL) 10.4
psql
reports errors differently depending on how input is passed:
-
$ psql -h 127.0.0.1 -U cbandy -X -A -t -q -c 'whoops' -p 34751 postgres ; echo $? ERROR: syntax error at or near "whoops" LINE 1: whoops ^ 1
-
N.B. exit code is zero here:
$ psql -h 127.0.0.1 -U cbandy -X -A -t -q -f <( echo 'whoops' ) -p 34751 postgres ; echo $? psql:/dev/fd/63:1: ERROR: syntax error at or near "whoops" LINE 1: whoops ^ 0
-
$ psql -h 127.0.0.1 -U cbandy -X -A -t -q -v ON_ERROR_STOP=1 -f <( echo 'whoops' ) -p 34751 postgres ; echo $? psql:/dev/fd/63:1: ERROR: syntax error at or near "whoops" LINE 1: whoops ^ 3