wanted to know how to print error output via psql command using below :
output of Insert_log.log shows only query statement not the error :
psql -h ${hostname} -p 5432 -U postgres -d ${DB_NAME} -a -f ${DIR}/log.sql -L Insert_log.log
[ec2-user@scripts]$ ./log.sh
\o
INSERT INTO mig.qb_tax_rates (id, xxx"}}', 18977);
psql:/home/ec2-user/scripts/log.sql:2:
ERROR: column "q_id" of relation "qb_tax_rates" does not exist
LINE 1: INSERT INTO mig.qb_tax_rates (id, q_id, sync_token, qb_updat...
[ec2-user@ip-10-99-99-999 scripts]$ cat Insert_log.log
********* QUERY **********
INSERT INTO mig.qb_tax_rates (id, xx}}', 18977);
**************************