How to make psql less verbose when I restore an SQL backup file? I want Postgres to only show me errors and maybe notices, nothing else.
So I want to see errors like this:
ERROR: relation "testing" does not exist
LINE 1: select * from testing
^
I do not want things like that:
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
SET
SET
SET
I need a more sane 😉 version of this:
psql -U postgres -d $dbName -f /tmp/${backupFile} 2>&1
| grep -vE 'CREATE SCHEMA|DROP TABLE|CREATE TABLE|ALTER TABLE|SET|set_config|------------|([0-9]+ rows?)'
3
The -q
does make psql quieter, but that’s not quite what you are after, you want to change the level of message that makes it to your screen.
export PGOPTIONS='-c client_min_messages=WARNING'
psql ...
That should remove all the SET
but will show any query results you may generate in the script.