I have configured psql
, the PostgreSQL command line client, with ~/.psqlrc
file, and I have the line \timing
, to show how long queries took. But psql
will print a line telling me that it has applied that setting. Can I turn that off?
My current psqlrc:
$ cat ~/.psqlrc
\pset pager off
\timing
which gives this output on my unix shell (bash):
$ psql -c "select version()"
Pager usage is off.
Timing is on.
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 14.5 (Debian 14.5-1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.1.0-8) 12.1.0, 64-bit
(1 row)
Time: 0.362 ms
I do not want the Pager usage is off.
or Timing is on.
messages to be printed. I want the \pager ...
and \tim...
settings to be quietly applied.
e.g.: I want this output:
$ psql -c "select version()"
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 14.5 (Debian 14.5-1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.1.0-8) 12.1.0, 64-bit
(1 row)
Time: 0.362 ms
Is this possible?
I am aware of -X
/--no-psqlrc
. But I want the setting applied without a debug message:
$ psql -X -c "select version()"
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 14.5 (Debian 14.5-1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.1.0-8) 12.1.0, 64-bit
(1 row)
Software versions: psql 14.5, with postgresql 14.5, installed via latest (2022年09月20日) apt on Debian testing/bookworm.
1 Answer 1
Make the first line in the .psqlrc be
\set QUIET on
And presumably the last line to turn it back off again.