How to get 'psql -q' runs really quiet ?

Started by Oleg Bartunovover 26 years ago3 messageshackers
Jump to latest
#1Oleg Bartunov
oleg@sai.msu.su

I need to run psql really quiet - no messages, just returning RC.
psql -q doesn't works as supposed from man page -
I'm still getting messages like:
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index .....
Is it a feature or I need to find some workaround

regards,
Oleg

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Oleg Bartunov (#1)
Re: [HACKERS] How to get 'psql -q' runs really quiet ?

Oleg Bartunov <oleg@sai.msu.su> writes:

I need to run psql really quiet - no messages, just returning RC.
psql -q doesn't works as supposed from man page -
I'm still getting messages like:
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index .....

The way libpq is set up, NOTICE messages *will* appear on stderr
no matter what, unless the client app overrides the default notice
message processor (which is this hugely complicated routine that
calls fprintf(stderr, ...) ;-)).

Perhaps psql ought to plug in a no-op notice message processor
if -q is specified.

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: [HACKERS] How to get 'psql -q' runs really quiet ?

Oleg Bartunov <oleg@sai.msu.su> writes:

I need to run psql really quiet - no messages, just returning RC.
psql -q doesn't works as supposed from man page -
I'm still getting messages like:
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index .....

The way libpq is set up, NOTICE messages *will* appear on stderr
no matter what, unless the client app overrides the default notice
message processor (which is this hugely complicated routine that
calls fprintf(stderr, ...) ;-)).

Perhaps psql ought to plug in a no-op notice message processor
if -q is specified.

But it is an elog. There is quite, and there is "Don't report any
errors". We don't have a flag for that. In fact, -q only turns of
greeting and goodbye, and -t turns off table headings and row counts.
Can't the user send these massages to /dev/null when starting psql, or
is the problem trimming out those notices? Can't grep -v do that for
them?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026