Check if a single request fails using the command line
I have two requests in one file:
select id from "user" where id = 1; // request passes select from "user"; // request fails
When I run the following commands in my shell:
psql -U username -d db_name -h host -p port -f test.sql echo $?
This will always prompt me to 0 (assuming the credentials are correct and the command
ran without an execution error). This looks pretty fair.
I was wondering if there is a way to get a different return code if one of the requests inside the linked file failed?
Thanks for the help.
source to share