Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to turn off "setval" output when import psql dump

I already tried both:

SET client_min_messages TO WARNING;

And the -q option when I ran:

psql -q -U postgres -d myDB -f /Users/hoaphan/dev/postgres_dump -p 5432

However its output(pages like this):

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

 setval
--------
      1
(1 row)

...
like image 346
HoaPhan Avatar asked Mar 27 '16 02:03

HoaPhan


1 Answers

The "quiet" option -q is defined as: "run quietly (no messages, only query output)".

The result of setval() is a query result, not a message, so the quiet option doesn't suppress this.

If you don't want to see query results, you can redirect their output to /dev/null using the -o switch:

psql -o /dev/null -q -U postgres -d myDB -f /Users/hoaphan/dev/postgres_dump -p 5432

(I can't test it on Linux right now, but the equivalent thing works on Windows)

like image 92
a_horse_with_no_name Avatar answered Oct 21 '22 09:10

a_horse_with_no_name