HoaPhan
HoaPhan

Reputation: 1936

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)

...

Upvotes: 18

Views: 2406

Answers (2)

Muihlinn
Muihlinn

Reputation: 571

I don't think you can turn it off without modifiying the dump file, or piping it to a custom filtering command, as that will mean turn off query output, but if you don't need any of the it, just use -o switch to redirect it to the file you like or /dev/null.

Upvotes: 0

user330315
user330315

Reputation:

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)

Upvotes: 21

Related Questions