Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress INFO messages when running psql scripts

I'm seeing INFO messages when I run my tests and I thought that I had gotten rid of them by setting the client_min_messages PGOPTION. Here's my command:


PGOPTIONS='--client-min-messages=warning' \
          psql  -h localhost \
                -p 5432 \
                -d my_db \
                -U my_user \
                --no-align \
                --field-separator '|' \
                --pset footer \
                --quiet \
                -v AUTOCOMMIT=off \
                -X \
                -v VERBOSITY=terse \
                -v ON_ERROR_STOP=1 \
                --pset pager=off \
                -f tests/test.sql \
                -o "$test_results"

Can someone advise me on how to turn off the INFO messages?

like image 989
bitcycle Avatar asked Jul 09 '12 22:07

bitcycle


1 Answers

This works for me: Postgres 9.1.4 on Debian GNU Linux with bash:

env PGOPTIONS='-c client_min_messages=WARNING' psql ...

(Still works for Postgres 12 on Ubuntu 18.04 LTS with bash.)

It's also what the manual suggests. In most shells, setting environment variables also works without an explicit leading env. See maxschlepzig's comment.

Note, however, that there is no message level INFO for client_min_messages.
That's only applicable to log_min_messages and log_min_error_statement.

like image 172
Erwin Brandstetter Avatar answered Nov 08 '22 20:11

Erwin Brandstetter