Search Postgresql Archives

Re: Making sure \timing is on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 12, 2008 at 05:30:48PM -0400, Bruce Momjian wrote:
> David Fetter wrote:
> > On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
> > > "Scott Marlowe" <scott.marlowe@xxxxxxxxx> writes:
> > > > Is it reasonable behavior to have \timing along toggle and \timing on
> > > > / \timing off be a forced switch?  Just thinking of other scripts
> > > > where this isn't a problem and having to update them.
> > > 
> > > The command without an argument should certainly keep the old toggle
> > > behavior, for backwards compatibility.
> > 
> > Attached patch does some of the right thing, but doesn't yet handle
> > error cases.  How liberal should we be about capitalization, spelling,
> > etc.?
> 
> Please try ParseVariableBool() in psql/variables.c, and use diff -c.

Thanks for the heads-up :)

Second patch attached, this time with some docs.

Cheers,
David.
-- 
David Fetter <david@xxxxxxxxxx> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@xxxxxxxxx

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
Index: doc/src/sgml/ref/psql-ref.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/psql-ref.sgml,v
retrieving revision 1.203
diff -c -r1.203 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml	8 May 2008 17:04:26 -0000	1.203
--- doc/src/sgml/ref/psql-ref.sgml	12 May 2008 21:56:59 -0000
***************
*** 1867,1876 ****
  
  
        <varlistentry>
!        <term><literal>\timing</literal></term>
          <listitem>
          <para>
!          Toggles a display of how long each SQL statement takes, in milliseconds.
          </para>
         </listitem>
        </varlistentry>
--- 1867,1879 ----
  
  
        <varlistentry>
!        <term><literal>\timing </literal> [<replaceable
! class="parameter">ON</replaceable> | <replaceable
! class="parameter">OFF</replaceable>] </term>
          <listitem>
          <para>
!          Without parameter, toggles a display of how long each SQL
! statement takes, in milliseconds.  With parameter, sets same.
          </para>
         </listitem>
        </varlistentry>
Index: src/bin/psql/command.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.188
diff -c -r1.188 command.c
*** src/bin/psql/command.c	8 May 2008 17:04:26 -0000	1.188
--- src/bin/psql/command.c	12 May 2008 21:57:01 -0000
***************
*** 884,890 ****
  	/* \timing -- toggle timing of queries */
  	else if (strcmp(cmd, "timing") == 0)
  	{
! 		pset.timing = !pset.timing;
  		if (!pset.quiet)
  		{
  			if (pset.timing)
--- 884,895 ----
  	/* \timing -- toggle timing of queries */
  	else if (strcmp(cmd, "timing") == 0)
  	{
! 		char	   *value = psql_scan_slash_option(scan_state,
! 												   OT_NORMAL, NULL, false);
! 		if (value)
! 		   pset.timing = ParseVariableBool(value);
! 		else
! 			pset.timing = !pset.timing;
  		if (!pset.quiet)
  		{
  			if (pset.timing)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux