Fwd: patch to suppress psql timing output in quiet mode

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Fwd: patch to suppress psql timing output in quiet mode
Date: 2007-04-11 20:52:02
Message-ID: b42b73150704111352w4aaf4b28l8ba34001a813786c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

[forwarded from -patches]

I noticed that when psql accepts input from stdin or -f (but not -c),
and timing is set to on in .psqlrc, timing results are printed out to
stdout even when -q (quiet) is passed in.

This may not be the perfect solution, but it fixes the problem (I'm
having problems with bash scripts that are borking on time returned).

current behavior:
[root(at)mernix psql]# echo "select 0" | psql -tAq
0
Time: 1.155 ms
[root(at)mernix psql]# psql -tAqc"select 0"
0

merlin

Index: common.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/common.c,v
retrieving revision 1.133
diff -c -r1.133 common.c
*** common.c 8 Feb 2007 11:10:27 -0000 1.133
--- common.c 11 Apr 2007 17:20:21 -0000
***************
*** 918,924 ****
PQclear(results);

/* Possible microtiming output */
! if (OK && pset.timing)
printf(_("Time: %.3f ms\n"), elapsed_msec);

/* check for events that may occur during query execution */
--- 918,924 ----
PQclear(results);

/* Possible microtiming output */
! if (OK && pset.timing && !pset.quiet)
printf(_("Time: %.3f ms\n"), elapsed_msec);

/* check for events that may occur during query execution */

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-04-11 20:52:16 Re: [HACKERS] [Fwd: Index Advisor]
Previous Message Magnus Hagander 2007-04-11 20:16:46 Re: New email list about migration?

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-04-11 20:52:16 Re: [HACKERS] [Fwd: Index Advisor]
Previous Message Merlin Moncure 2007-04-11 17:24:52 patch to suppress psql timing output in quiet mode