When running PostgreSQL with a single SQL command error codes are returned as expected:
% psql -c "SELECT * FROM AWDASDASDASDAS" my_db
ERROR: relation "awdasdasdasdas" does not exist
LINE 1: SELECT * FROM AWDASDASDASDAS
% echo $?
1
But when running a file, the error is suppressed:
% psql -f test.sql my_db
psql:test.sql:1: ERROR: relation "awdasdasdasdas" does not exist
LINE 1: SELECT * FROM AWDASDASDASDAS
% echo $?
0
Any idea how to get these errors back?
psql
maybe? – alex Jul 17 '11 at 10:09