Making sure \timing is on

Lists: pgsql-generalpgsql-patches
From: Francisco Reyes <lists(at)stringsutils(dot)com>
To: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Making sure \timing is on
Date: 2008-05-11 23:52:00
Message-ID: cone.1210549920.240286.22645.1000@zoraida.natserv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

Is there a way to make certain \timing is on?

I am looking for something simmilar to what one can do with the pager
\pset pager always

Most scripts I am working with (inheritted) don't have \timing in them so I
can put timing on/off as needed. However some scripts already have it. So if
I set \timing before the script and the script calls it again then it gets
turned off.

As I go over all the scripts it will be less of an issue, but I still would
like a way to make sure timing is on, before I run some scripts without
having to first check the script to see if I had put \timing in the script
or not.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Francisco Reyes <lists(at)stringsutils(dot)com>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 00:24:17
Message-ID: 2137.1210551857@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

Francisco Reyes <lists(at)stringsutils(dot)com> 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


From: Francisco Reyes <lists(at)stringsutils(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 02:43:19
Message-ID: cone.1210560199.681781.22645.1000@zoraida.natserv.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

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.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Francisco Reyes <lists(at)stringsutils(dot)com>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 03:04:33
Message-ID: 4231.1210561473@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

Francisco Reyes <lists(at)stringsutils(dot)com> 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


From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Francisco Reyes" <lists(at)stringsutils(dot)com>, "PostgreSQL general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 03:25:54
Message-ID: dcc563d10805112025v676b884bi7bf228685f53e7f3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

On Sun, May 11, 2008 at 9:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Francisco Reyes <lists(at)stringsutils(dot)com> 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.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: "Francisco Reyes" <lists(at)stringsutils(dot)com>, "PostgreSQL general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 03:48:29
Message-ID: 4691.1210564109@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

"Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> 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


From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 21:17:06
Message-ID: 20080512211706.GA22159@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
> "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> 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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

Attachment Content-Type Size
psql_set_timing.patch text/plain 539 bytes

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 21:30:48
Message-ID: 200805122130.m4CLUmc03905@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

David Fetter wrote:
> On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
> > "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> 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 <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 21:32:56
Message-ID: 20080512213255.GF19344@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

David Fetter escribió:
> On Sun, May 11, 2008 at 11:48:29PM -0400, Tom Lane wrote:
> > "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> 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 Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: David Fetter <david(at)fetter(dot)org>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-12 21:57:57
Message-ID: 20080512215757.GB22159@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

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(dot)marlowe(at)gmail(dot)com> 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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

Attachment Content-Type Size
psql_set_timing.patch text/plain 1.9 KB

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 14:26:26
Message-ID: 20080513142626.GA6966@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

David Fetter escribió:

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

Added to July commitfest.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 14:38:26
Message-ID: 25111.1210689506@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

Alvaro Herrera <alvherre(at)commandprompt(dot)com> 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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 14:47:40
Message-ID: 20080513144740.GC6966@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

Tom Lane escribió:
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> 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 Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: David Fetter <david(at)fetter(dot)org>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 15:14:51
Message-ID: 20080513151451.GB3214@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

On Tue, May 13, 2008 at 10:47:40AM -0400, Alvaro Herrera wrote:
> Tom Lane escribió:
> > Alvaro Herrera <alvherre(at)commandprompt(dot)com> 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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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


From: David Fetter <david(at)fetter(dot)org>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 15:23:34
Message-ID: 20080513152333.GC3214@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

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 <alvherre(at)commandprompt(dot)com> 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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

Attachment Content-Type Size
psql_set_timing.patch text/plain 2.1 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 15:36:57
Message-ID: 26160.1210693017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

David Fetter <david(at)fetter(dot)org> 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


From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 20:53:33
Message-ID: 20080513205333.GC31923@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

On Tue, May 13, 2008 at 11:36:57AM -0400, Tom Lane wrote:
> David Fetter <david(at)fetter(dot)org> 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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

Attachment Content-Type Size
psql_enum-2.patch text/plain 1.5 KB

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 21:06:39
Message-ID: 20080513210639.GD31923@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

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 <david(at)fetter(dot)org> 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 <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

Attachment Content-Type Size
psql_toggles.patch text/plain 6.0 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-13 23:11:01
Message-ID: 7719.1210720261@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

David Fetter <david(at)fetter(dot)org> 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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Francisco Reyes <lists(at)stringsutils(dot)com>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Making sure \timing is on
Date: 2008-05-14 00:43:28
Message-ID: 20080514004328.GP6966@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-patches

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 Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.