0

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.

asked Sep 20, 2022 at 7:21

1 Answer 1

2

Make the first line in the .psqlrc be

\set QUIET on

And presumably the last line to turn it back off again.

answered Sep 20, 2022 at 15:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.