Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes:
 David Fetter escribió:
 Thanks for the heads-up :)
 
 Second patch attached, this time with some docs.

 Added to July commitfest.

Surely this is merely proof of concept and not a complete patch.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread David Fetter
On Tue, May 13, 2008 at 10:47:40AM -0400, Alvaro Herrera wrote:
 Tom Lane escribió:
  Alvaro Herrera [EMAIL PROTECTED] writes:
   David Fetter escribi?:
   Thanks for the heads-up :)
   
   Second patch attached, this time with some docs.
  
   Added to July commitfest.
  
  Surely this is merely proof of concept and not a complete patch.
 
 David, ya heard da man :-)

Next patch attached :)

Cheers,
David (free() the malloc()s!)
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread David Fetter
On Tue, May 13, 2008 at 08:14:51AM -0700, David Fetter wrote:
 On Tue, May 13, 2008 at 10:47:40AM -0400, Alvaro Herrera wrote:
  Tom Lane escribió:
   Alvaro Herrera [EMAIL PROTECTED] writes:
David Fetter escribi?:
Thanks for the heads-up :)

Second patch attached, this time with some docs.
   
Added to July commitfest.
   
   Surely this is merely proof of concept and not a complete patch.
  
  David, ya heard da man :-)
 
 Next patch attached :)
 
 Cheers,
 David (free() the malloc()s!)

*Sigh*

This time with the patch actually attached :P

Cheers,
David
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

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 -c -r1.203 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml  8 May 2008 17:04:26 -   1.203
--- doc/src/sgml/ref/psql-ref.sgml  13 May 2008 14:41:18 -
***
*** 1867,1876 
  
  
varlistentry
!termliteral\timing/literal/term
  listitem
  para
!  Toggles a display of how long each SQL statement takes, in 
milliseconds.
  /para
 /listitem
/varlistentry
--- 1867,1879 
  
  
varlistentry
!termliteral\timing /literal [replaceable
! class=parameterON/replaceable | replaceable
! class=parameterOFF/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 -c -r1.188 command.c
*** src/bin/psql/command.c  8 May 2008 17:04:26 -   1.188
--- src/bin/psql/command.c  13 May 2008 14:41:21 -
***
*** 884,890 
/* \timing -- toggle timing of queries */
else if (strcmp(cmd, timing) == 0)
{
!   pset.timing = !pset.timing;
if (!pset.quiet)
{
if (pset.timing)
--- 903,914 
/* \timing -- toggle timing of queries */
else if (strcmp(cmd, timing) == 0)
{
!   char   *opt = psql_scan_slash_option(scan_state,
!   
 OT_NORMAL, NULL, false);
!   if (opt)
!  pset.timing = ParseVariableBool(opt);
!   else
!   pset.timing = !pset.timing;
if (!pset.quiet)
{
if (pset.timing)
***
*** 892,897 
--- 916,922 
else
puts(_(Timing is off.));
}
+   free(opt);
}
  
/* \unset */

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread Alvaro Herrera
David Fetter escribió:

 Thanks for the heads-up :)
 
 Second patch attached, this time with some docs.

Added to July commitfest.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread Alvaro Herrera
Tom Lane escribió:
 Alvaro Herrera [EMAIL PROTECTED] writes:
  David Fetter escribi�:
  Thanks for the heads-up :)
  
  Second patch attached, this time with some docs.
 
  Added to July commitfest.
 
 Surely this is merely proof of concept and not a complete patch.

David, ya heard da man :-)

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread Tom Lane
David Fetter [EMAIL PROTECTED] writes:
 Surely this is merely proof of concept and not a complete patch.
 
 Next patch attached :)

Uh, my point was that the agreement was to do this to *all* of psql's
toggling backslash commands, not only \timing.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread David Fetter
On Tue, May 13, 2008 at 11:36:57AM -0400, Tom Lane wrote:
 David Fetter [EMAIL PROTECTED] writes:
  Surely this is merely proof of concept and not a complete patch.
  
  Next patch attached :)
 
 Uh, my point was that the agreement was to do this to *all* of
 psql's toggling backslash commands, not only \timing.

Done :)

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
Index: src/bin/psql/describe.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.168
diff -c -c -r1.168 describe.c
*** src/bin/psql/describe.c 2 May 2008 10:16:16 -   1.168
--- src/bin/psql/describe.c 4 May 2008 23:54:53 -
***
*** 307,315 
  WHEN t.typlen  0\n
THEN CAST('var' AS 
pg_catalog.text)\n
  ELSE CAST(t.typlen AS 
pg_catalog.text)\n
!   END AS \%s\,\n,
  gettext_noop(Internal name),
! gettext_noop(Size));
appendPQExpBuffer(buf,
  pg_catalog.obj_description(t.oid, 'pg_type') 
as \%s\\n,
  gettext_noop(Description));
--- 307,325 
  WHEN t.typlen  0\n
THEN CAST('var' AS 
pg_catalog.text)\n
  ELSE CAST(t.typlen AS 
pg_catalog.text)\n
!   END AS \%s\,\n
!   
pg_catalog.array_to_string(\n
!   ARRAY(\n
!   SELECT 
e.enumlabel\n
!   FROM 
pg_catalog.pg_enum e\n
!   WHERE e.enumtypid 
= t.oid\n
!   ORDER BY e.oid\n
!   ),\n
!   E'\\n'\n
!   ) AS \%s\,\n,
  gettext_noop(Internal name),
! gettext_noop(Size),
! gettext_noop(Elements));
appendPQExpBuffer(buf,
  pg_catalog.obj_description(t.oid, 'pg_type') 
as \%s\\n,
  gettext_noop(Description));

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread David Fetter
On Tue, May 13, 2008 at 01:53:33PM -0700, David Fetter wrote:
 On Tue, May 13, 2008 at 11:36:57AM -0400, Tom Lane wrote:
  David Fetter [EMAIL PROTECTED] writes:
   Surely this is merely proof of concept and not a complete patch.
   
   Next patch attached :)
  
  Uh, my point was that the agreement was to do this to *all* of
  psql's toggling backslash commands, not only \timing.
 
 Done :)

Ugh.  This time with the correct patch attached :P

Cheers,
David (not having much luck with attachments)
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

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 -c -r1.203 psql-ref.sgml
*** doc/src/sgml/ref/psql-ref.sgml  8 May 2008 17:04:26 -   1.203
--- doc/src/sgml/ref/psql-ref.sgml  13 May 2008 20:52:29 -
***
*** 673,685 
  
  variablelist
varlistentry
! termliteral\a/literal/term
  listitem
  para
! If the current table output format is unaligned, it is switched to 
aligned.
! If it is not unaligned, it is set to unaligned. This command is
! kept for backwards compatibility. See command\pset/command for a
! more general solution.
  /para
  /listitem
/varlistentry
--- 673,687 
  
  variablelist
varlistentry
!termliteral\a /literal [ replaceable
! class=parameterON/replaceable |
! replaceable class=parameterOFF/replaceable ] /term
  listitem
  para
! Without parameter, toggle format between aligned and
! unaligned.  With parameter, set it.  This command is kept for
! backwards compatibility. See command\pset/command for a more
! general solution.
  /para
  /listitem
/varlistentry
***
*** 1292,1305 
  
  
varlistentry
! termliteral\H/literal/term
  listitem
  para
! Turns on acronymHTML/acronym query output format. If the
! acronymHTML/acronym format is already on, it is switched
! back to the default aligned text format. This command is for
! compatibility and convenience, but see command\pset/command
! about setting other output options.
  /para
  /listitem
/varlistentry
--- 1294,1308 
  
  
varlistentry
!termliteral\H /literal [ replaceable
! class=parameterON/replaceable |
! replaceable class=parameterOFF/replaceable ] /term
  listitem
  para
! Without parameter, toggles between acronymHTML/acronym and
! aligned query output format.  With paramter, sets it.
! This command is for compatibility and convenience, but see
! command\pset/command about setting other output options.
  /para
  /listitem
/varlistentry
***
*** 1867,1876 
  
  
varlistentry
!termliteral\timing/literal/term
  listitem
  para
!  Toggles a display of how long each SQL statement takes, in 
milliseconds.
  /para
 /listitem
/varlistentry
--- 1870,1882 
  
  
varlistentry
!termliteral\timing /literal [replaceable
! class=parameterON/replaceable | replaceable
! class=parameterOFF/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 -c -r1.188 command.c
*** src/bin/psql/command.c  8 May 2008 17:04:26 -   1.188
--- src/bin/psql/command.c  13 May 2008 20:52:29 -
***
*** 180,189 
 */
if (strcmp(cmd, a) == 0)
{
!   if (pset.popt.topt.format != PRINT_ALIGNED)
!   success = do_pset(format, aligned, pset.popt, 
pset.quiet);
else
!   success = do_pset(format, unaligned, pset.popt, 
pset.quiet);
}
  
/* \C -- override table title (formerly change HTML caption) */
--- 180,199 
 */
if (strcmp(cmd, a) == 0)
{
!   char   *opt = psql_scan_slash_option(scan_state,
!   
 OT_NORMAL, NULL, true);
!   if (opt)
!   success = do_pset(format,
!  

Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread Tom Lane
David Fetter [EMAIL PROTECTED] writes:
 On Tue, May 13, 2008 at 11:36:57AM -0400, Tom Lane wrote:
 Uh, my point was that the agreement was to do this to *all* of
 psql's toggling backslash commands, not only \timing.
 
 Done :)

Hmm, I thought we had a lot more than three that were like this.
But on looking closer, I guess all the other ones are \pset boolean
options that already behave properly.

Actually, \a and \H are fairly bogus anyway, because they are toggling
a setting that has more than two values.  I wonder whether defining the
argument as a boolean is really very sane.  Perhaps it would be better to
take the argument if given as just a regular format setting --- ie,
with an argument, either of these would just be a shorthand for
\pset format.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-13 Thread Alvaro Herrera
Tom Lane escribió:

 Actually, \a and \H are fairly bogus anyway, because they are toggling
 a setting that has more than two values.  I wonder whether defining the
 argument as a boolean is really very sane.  Perhaps it would be better to
 take the argument if given as just a regular format setting --- ie,
 with an argument, either of these would just be a shorthand for
 \pset format.

Agreed -- they are bogus.  However, making \H aligned be an alias for
\pset format aligned does not look very sane either (is that html
aligned or what?)

Seeing how these have been deprecated for a very long while, perhaps the
thing to do is leave their behavior alone and throw a warning when they
are used; in a couple more releases, remove them.  However this isn't
very sane either, because we'd break scripts that are using \H for no
good reason.

Another thing we could do is keep them as toggles, but instead of
aligned/HTML and aligned/unaligned, make them remember the state that
was set at the time they were called, and toggle between HTML (or
aligned) and the last state.

... except that since aligned is the default mode, \a should not toggle
between last state and aligned, but rather between last state and
unaligned.  Which makes it a misnomer.

Or maybe the thing to do is leave them damn well alone and just fix
\timing.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-12 Thread David Fetter
On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
 Scott Marlowe [EMAIL PROTECTED] 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.?

Cheers,
David.
-- 
David Fetter [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
Index: src/bin/psql/command.c
===
RCS file: /projects/cvsroot/pgsql/src/bin/psql/command.c,v
retrieving revision 1.188
diff -r1.188 command.c
887c887,897
   pset.timing = !pset.timing;
---
   char   *opt = psql_scan_slash_option(scan_state,
   
  OT_NORMAL, NULL, true);
   if (opt)
   {
   if (strcmp(opt, on) == 0)
   pset.timing = true;
   else if (strcmp(opt, off) == 0)
   pset.timing = false;
   }
   else
   pset.timing = !pset.timing;

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-12 Thread Bruce Momjian
David Fetter wrote:
 On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
  Scott Marlowe [EMAIL PROTECTED] 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.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-12 Thread Alvaro Herrera
David Fetter escribió:
 On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
  Scott Marlowe [EMAIL PROTECTED] 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,

Hmm, there's already code for parsing boolean variables in psql, see
ParseVariableBool.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-12 Thread David Fetter
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 [EMAIL PROTECTED] 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 [EMAIL PROTECTED] http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: [EMAIL PROTECTED]

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 -   1.203
--- doc/src/sgml/ref/psql-ref.sgml  12 May 2008 21:56:59 -
***
*** 1867,1876 
  
  
varlistentry
!termliteral\timing/literal/term
  listitem
  para
!  Toggles a display of how long each SQL statement takes, in 
milliseconds.
  /para
 /listitem
/varlistentry
--- 1867,1879 
  
  
varlistentry
!termliteral\timing /literal [replaceable
! class=parameterON/replaceable | replaceable
! class=parameterOFF/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 -   1.188
--- src/bin/psql/command.c  12 May 2008 21:57:01 -
***
*** 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)

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-11 Thread Tom Lane
Francisco Reyes [EMAIL PROTECTED] writes:
 Is there a way to make certain \timing is on?

Not that I know of :-(.  There's been discussion of fixing all of psql's
toggle commands to offer \foo on and \foo off variants, which
would be far more scripting-friendly ... but nobody's stepped up to do it.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-11 Thread Francisco Reyes

Tom Lane writes:


Not that I know of :-(.  There's been discussion of fixing all of psql's
toggle commands to offer \foo on and \foo off


What would be a good starting point for someone interesting in looking into 
working on that?


Started a job recently as PostgresSQL DBA.. so sooner or later I will want 
to start looking at the code. This may be one way to get my feet wet with 
the code.



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-11 Thread Tom Lane
Francisco Reyes [EMAIL PROTECTED] writes:
 Tom Lane writes:
 Not that I know of :-(.  There's been discussion of fixing all of psql's
 toggle commands to offer \foo on and \foo off

 What would be a good starting point for someone interesting in looking into 
 working on that?

This'd be a fine starting project IMHO, if you can read/code C at all.
The rubber meets the road in exec_command() in src/bin/psql/command.c
--- look around in that area.  In particular note that ParseVariableBool
in variables.c probably ought to be what you use to interpret the
meaning of the argument.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-11 Thread Scott Marlowe
On Sun, May 11, 2008 at 9:04 PM, Tom Lane [EMAIL PROTECTED] wrote:
 Francisco Reyes [EMAIL PROTECTED] writes:
 Tom Lane writes:
 Not that I know of :-(.  There's been discussion of fixing all of psql's
 toggle commands to offer \foo on and \foo off

 What would be a good starting point for someone interesting in looking into
 working on that?

 This'd be a fine starting project IMHO, if you can read/code C at all.
 The rubber meets the road in exec_command() in src/bin/psql/command.c
 --- look around in that area.  In particular note that ParseVariableBool
 in variables.c probably ought to be what you use to interpret the
 meaning of the argument.

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.

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Making sure \timing is on

2008-05-11 Thread Tom Lane
Scott Marlowe [EMAIL PROTECTED] 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.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general