Re: psql possible TODO

Lists: pgsql-hackers
From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql possible TODO
Date: 2006-12-05 20:25:47
Message-ID: 1165350347.31648.40.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,

A reasonable simple feature we were thinking about sponsoring was an
addition to psql. Currently if you perform a \s within psql it gives
you the query buffer. My suggestion is that \s give us a execution
number, similar to bash. Thus at a psql prompt we could do:

foo=> !76

And it would execute whatever query was number 76. Secondly:

foo=> !!76

Would execute an explain on whatever query was 76. Lastly:

foo=> !(at)76

Would execute an explain analyze within a transaction and a rollback (so
we could do updates/deletes).

I am of course open to other thoughts but it certainly seems like a nice
shortcut.

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 21:01:34
Message-ID: 11050.1165352494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> Hello,
> A reasonable simple feature we were thinking about sponsoring was an
> addition to psql. Currently if you perform a \s within psql it gives
> you the query buffer. My suggestion is that \s give us a execution
> number, similar to bash. Thus at a psql prompt we could do:

> foo=> !76

> And it would execute whatever query was number 76. Secondly:

> foo=> !!76

> Would execute an explain on whatever query was 76. Lastly:

> foo=> !(at)76

> Would execute an explain analyze within a transaction and a rollback (so
> we could do updates/deletes).

Surely you must use backslash commands for this. Or had you forgotten
that ! and @ are legal operator characters in Postgres?

Also, you can't take away the existing functionality of \s. Invent some
other command instead.

But lastly, do we need this at all? It seems like a relatively awkward,
highly error-prone way to do what you can do today with control-P and
re-execute.

regards, tom lane


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 21:13:04
Message-ID: 1165353184.31648.53.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> > Would execute an explain analyze within a transaction and a rollback (so
> > we could do updates/deletes).
>
> Surely you must use backslash commands for this. Or had you forgotten
> that ! and @ are legal operator characters in Postgres?

Well I didn't forget, but I assumed we could use the psql parser to
handle the \^\*\![0-9] (that is likely not the correct regex).

>
> Also, you can't take away the existing functionality of \s. Invent some
> other command instead.

I wouldn't assume that we would be taking it away. The only difference
is that at \^ there would be a number. I am not sure how that effects
anyone using \s anyway since \s picks up all errors etc...

>
> But lastly, do we need this at all? It seems like a relatively awkward,
> highly error-prone way to do what you can do today with control-P and
> re-execute.

If you mean control-P as in "paste" then I would say... get your hands
off the mouse. The mouse is counter productive and it is faster to do
this:

=> \s
76 SELECT * FROM Foo;
=> !76

Just like bash. I certainly don't have a problem with uses different
characters or the like and am open to any suggestion thereof. The reason
I picked ! was because it is what bash uses. The reason I picked !@ is
because they are right next to each other.

Sincerely,

Joshua D. Drake

>
> regards, tom lane
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 21:32:40
Message-ID: 11397.1165354360@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
>> But lastly, do we need this at all? It seems like a relatively awkward,
>> highly error-prone way to do what you can do today with control-P and
>> re-execute.

> If you mean control-P as in "paste" then I would say... get your hands
> off the mouse. The mouse is counter productive and it is faster to do
> this:

No, I mean control-P as in "recall the previous entry". What you showed
takes *more* work to recall a recent entry than hitting control-P a few
times. It has vastly greater chance of error, too, ie, executing the
wrong command for lack of any feedback about what it is you're really
about to execute. I will grant that control-P isn't a good way to
recall an entry from dozens or hundreds of commands ago, but that's what
control-R is for; and I don't see that a command number would help any
for that anyway.

> Just like bash.

What we have is just like bash --- at least the parts of it that I use.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 21:34:51
Message-ID: 200612052134.kB5LYpC18743@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> >> But lastly, do we need this at all? It seems like a relatively awkward,
> >> highly error-prone way to do what you can do today with control-P and
> >> re-execute.
>
> > If you mean control-P as in "paste" then I would say... get your hands
> > off the mouse. The mouse is counter productive and it is faster to do
> > this:
>
> No, I mean control-P as in "recall the previous entry". What you showed
> takes *more* work to recall a recent entry than hitting control-P a few
> times. It has vastly greater chance of error, too, ie, executing the
> wrong command for lack of any feedback about what it is you're really
> about to execute. I will grant that control-P isn't a good way to
> recall an entry from dozens or hundreds of commands ago, but that's what
> control-R is for; and I don't see that a command number would help any
> for that anyway.
>
> > Just like bash.
>
> What we have is just like bash --- at least the parts of it that I use.

This reminds me of the old csh function where you could recall things by
numbers and do search/replace on them. The capability was so hard to
use I could imagine anyone _normal_ using it.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 21:43:02
Message-ID: 20061205214302.GK44124@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 01:13:04PM -0800, Joshua D. Drake wrote:
> If you mean control-P as in "paste" then I would say... get your hands
> off the mouse. The mouse is counter productive and it is faster to do
> this:
>
> => \s
> 76 SELECT * FROM Foo;
> => !76

+1. I often find myself having to edit a pasted command just to add in
either explain or explain analyze when I'm doing performance tuning.
Granted, this should be easier in 8.2 with the improved buffer/up-arrow
behavior, but it's still not as handy as doing something like !42.
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 21:55:04
Message-ID: 20061205215504.GN14220@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jim C. Nasby wrote:
> On Tue, Dec 05, 2006 at 01:13:04PM -0800, Joshua D. Drake wrote:
> > If you mean control-P as in "paste" then I would say... get your hands
> > off the mouse. The mouse is counter productive and it is faster to do
> > this:
> >
> > => \s
> > 76 SELECT * FROM Foo;
> > => !76
>
> +1. I often find myself having to edit a pasted command just to add in
> either explain or explain analyze when I'm doing performance tuning.
> Granted, this should be easier in 8.2 with the improved buffer/up-arrow
> behavior, but it's still not as handy as doing something like !42.

Hmm, what is NOT the answer to the ultimate question of Life, the
Universe and Everything? Doesn't make much sense to me ...

+1 on the !<num>, but I agree with Tom that the ! had better be a \
command (and \! is already taken).

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


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:05:20
Message-ID: 1165356320.31648.61.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> No, I mean control-P as in "recall the previous entry". What you showed
> takes *more* work to recall a recent entry than hitting control-P a few
> times. It has vastly greater chance of error, too, ie, executing the
> wrong command for lack of any feedback about what it is you're really
> about to execute. I will grant that control-P isn't a good way to
> recall an entry from dozens or hundreds of commands ago, but that's what
> control-R is for; and I don't see that a command number would help any
> for that anyway.

control-R isn't real useful for 17 queries that are exactly the same
except for 3 different join clauses. It also isn't useful when you don't
know exactly what query you are looking for.

>
> > Just like bash.
>
> What we have is just like bash --- at least the parts of it that I use.

Yes, and I am trying to add more functionality that is like bash :)

Sincerely,

Joshua D. Drake

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Stephen Harris <lists(at)spuddy(dot)org>
To: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:08:16
Message-ID: 20061205220816.GA31948@pugwash.spuddy.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 06:55:04PM -0300, Alvaro Herrera wrote:
> +1 on the !<num>, but I agree with Tom that the ! had better be a \
> command (and \! is already taken).

Extend \r maybe, so \r on it's own clears the buffer whereas \r ###
will load it with history entry ###. Mnemonic; r=retrieve command

Silly: You could even do \r xyz and load the buffer with the last line
beginning xyz

(this would parallel the "r" command in Korn Shell which does
history in this way; "r 10" would rerun history entry 10; "r ls" would
redo the last ls command).

--

rgds
Stephen


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:10:44
Message-ID: 1165356644.31648.68.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> > > Just like bash.
> >
> > What we have is just like bash --- at least the parts of it that I use.
>
> This reminds me of the old csh function where you could recall things by
> numbers and do search/replace on them. The capability was so hard to
> use I could imagine anyone _normal_ using it.

Except that this has nothing to do with that. This is *standard* feature
set for the unix shell:

794 scp admin(at)compile(dot)commandprompt(dot)com:pgdump* .
795 scp admin(at)compile(dot)commandprompt(dot)com:*bench* .
796 joe pgbench.results
797 ps a-x
798 ps -ax
799 bin/psql -U jd -p5500 bench
800 bin/psql -U jd -p5501 bench
801 bin/pg_ctl -D slave0 stop
802 bin/pg_ctl -D slave1 stop
803 joe bin/starttest.sh
804 history
805 joe bin/starttest.sh
806 history

Oh... that's right, its call starttest.sh:

!805

Except for PostgreSQL it would be:

postgres=# \s

1 SELECT * from cmd_pg_stat_all_tables ;
2 SELECT count(*) from cmd_pg_stat_all_tables ;
3 SELECT count(*) from cmd_pg_stat_database;

postgres=# !1

Otherwise I either have to copy and paste what is 1 or I have to do a
ctrl-r. So now i have done a \s to see what queries are in the buffer
and then I am doing a ctrl-r to get the info out of the buffer. That's
silly. When if there was a number associated, I could just execute
whatever I need.

I am regularly in 100 different catalogs a week, I can't always remember
what is going on from one to the other. I use \s all the time to help
with this. Eliminating the need for a mouse or to cycle through ctrl-r
would make this alot easier.

Don't get me wrong, ctrl-r is great, but it is not an end all :)

Sincerely,

Joshua D. Drake

>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:11:20
Message-ID: 1165356680.31648.70.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 18:55 -0300, Alvaro Herrera wrote:
> Jim C. Nasby wrote:
> > On Tue, Dec 05, 2006 at 01:13:04PM -0800, Joshua D. Drake wrote:
> > > If you mean control-P as in "paste" then I would say... get your hands
> > > off the mouse. The mouse is counter productive and it is faster to do
> > > this:
> > >
> > > => \s
> > > 76 SELECT * FROM Foo;
> > > => !76
> >
> > +1. I often find myself having to edit a pasted command just to add in
> > either explain or explain analyze when I'm doing performance tuning.
> > Granted, this should be easier in 8.2 with the improved buffer/up-arrow
> > behavior, but it's still not as handy as doing something like !42.
>
> Hmm, what is NOT the answer to the ultimate question of Life, the
> Universe and Everything? Doesn't make much sense to me ...
>
> +1 on the !<num>, but I agree with Tom that the ! had better be a \
> command (and \! is already taken).

Yeah I am good with changing the !.

Sincerely,

Joshua D. Drake

>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:30:03
Message-ID: 14267.1165357803@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> control-R isn't real useful for 17 queries that are exactly the same
> except for 3 different join clauses. It also isn't useful when you don't
> know exactly what query you are looking for.

... but, somehow, you know exactly what command number it has?
The above seems completely unimpressive as arguments for adding
command-number-based recall.

>> What we have is just like bash --- at least the parts of it that I use.
> Yes, and I am trying to add more functionality that is like bash :)

It's like a part of bash that's been obsolete since readline was
written, and probably would never have existed at all if readline had
appeared first. I can't really picture a situation in which this is an
improvement over the readline facilities.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:34:13
Message-ID: 200612052234.kB5MYDn24974@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > control-R isn't real useful for 17 queries that are exactly the same
> > except for 3 different join clauses. It also isn't useful when you don't
> > know exactly what query you are looking for.
>
> ... but, somehow, you know exactly what command number it has?
> The above seems completely unimpressive as arguments for adding
> command-number-based recall.
>
> >> What we have is just like bash --- at least the parts of it that I use.
> > Yes, and I am trying to add more functionality that is like bash :)
>
> It's like a part of bash that's been obsolete since readline was
> written, and probably would never have existed at all if readline had
> appeared first. I can't really picture a situation in which this is an
> improvement over the readline facilities.

Yea, that was my impression. It seemed so awkward, but so is 'vi' to
me. (Me ducks.)

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Harris <lists(at)spuddy(dot)org>
Cc: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:34:58
Message-ID: 14864.1165358098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stephen Harris <lists(at)spuddy(dot)org> writes:
> Silly: You could even do \r xyz and load the buffer with the last line
> beginning xyz

We've got that: control-R xyz.

The thing I'm having a hard time with here is the notion that command
number is a convenient way of identifying prior commands. It seems like
an idea that should have gone out with punched cards.

regards, tom lane


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:42:31
Message-ID: 20061205224231.GE18593@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > control-R isn't real useful for 17 queries that are exactly the same
> > except for 3 different join clauses. It also isn't useful when you don't
> > know exactly what query you are looking for.
>
> ... but, somehow, you know exactly what command number it has?

Well, presumably \s would give you the numbers. "history" does on bash anyway.

I use it on bash all the time: I do "history | grep something" and then
!<number of command I want>.

I don't think we can do the "| grep" part, but it's useful anyway.

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


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:43:04
Message-ID: 1165358584.31648.83.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 17:30 -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > control-R isn't real useful for 17 queries that are exactly the same
> > except for 3 different join clauses. It also isn't useful when you don't
> > know exactly what query you are looking for.
>
> ... but, somehow, you know exactly what command number it has?

I would after I did a \s yes.

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:43:44
Message-ID: 1165358624.31648.85.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> > It's like a part of bash that's been obsolete since readline was
> > written, and probably would never have existed at all if readline had
> > appeared first. I can't really picture a situation in which this is an
> > improvement over the readline facilities.
>
> Yea, that was my impression. It seemed so awkward, but so is 'vi' to
> me. (Me ducks.)

Well you won't get any argument from me about vi ;) but as others have
already mentioned, it is useful to some.

Sincerely,

Joshua D. Drake

>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:45:13
Message-ID: 200612052245.kB5MjDf26529@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Tom Lane wrote:
> > "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > > control-R isn't real useful for 17 queries that are exactly the same
> > > except for 3 different join clauses. It also isn't useful when you don't
> > > know exactly what query you are looking for.
> >
> > ... but, somehow, you know exactly what command number it has?
>
> Well, presumably \s would give you the numbers. "history" does on bash anyway.
>
> I use it on bash all the time: I do "history | grep something" and then
> !<number of command I want>.
>
> I don't think we can do the "| grep" part, but it's useful anyway.

OK, now at least I understand how it would be used, and could be
explained easily in the documentation --- do \s, then \! 99, or maybe \#
99. I don't like making \! do shells and pull SQL commands from history.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:46:54
Message-ID: 1165358814.31648.89.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 17:34 -0500, Tom Lane wrote:
> Stephen Harris <lists(at)spuddy(dot)org> writes:
> > Silly: You could even do \r xyz and load the buffer with the last line
> > beginning xyz
>
> We've got that: control-R xyz.
>
> The thing I'm having a hard time with here is the notion that command
> number is a convenient way of identifying prior commands. It seems like
> an idea that should have gone out with punched cards.

Imagine that you are profiling 50 queries, the queries are all the same
except for varying where clauses or joins.

Perhaps you are building out a query that contains 50 joins, and you are
building one step at a time (which I do ALL the time). You get to join
47 and realize that your data set isn't right.

Now, there is a chance that query 46 is the query that I want, but
ooops, I have 3 syntax errors so now it is actually query 43. How do I
get back to 43?

I ctrl-r... which really doesn't seem useful in this sense.
I \s and copy and paste? Even worse and what I do now.

Or... I \s and hit !46 (or whatever the ! becomes).

!46 seems awful easy to me.

Worse yet... what if it is actually query 27 because I got distracted by
a support question over jabber from the customer I am actually working
on and I need to help him profile a query for a couple of minutes?

Sincerely,

Joshua D. Drake

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:50:47
Message-ID: 1165359047.31648.91.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 17:45 -0500, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Tom Lane wrote:
> > > "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > > > control-R isn't real useful for 17 queries that are exactly the same
> > > > except for 3 different join clauses. It also isn't useful when you don't
> > > > know exactly what query you are looking for.
> > >
> > > ... but, somehow, you know exactly what command number it has?
> >
> > Well, presumably \s would give you the numbers. "history" does on bash anyway.
> >
> > I use it on bash all the time: I do "history | grep something" and then
> > !<number of command I want>.
> >
> > I don't think we can do the "| grep" part, but it's useful anyway.
>
> OK, now at least I understand how it would be used, and could be
> explained easily in the documentation --- do \s, then \! 99, or maybe \#
> 99. I don't like making \! do shells and pull SQL commands from history.

Yeah the # was the next logical thing. Would we have to escape it?

\#12... hmmm
#12

I prefer #12

Sincerely,

Joshua D. Drkae

>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Svenne Krap <svenne(at)krap(dot)dk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:52:58
Message-ID: 4575F84A.3010802@krap.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> We've got that: control-R xyz.
>
> The thing I'm having a hard time with here is the notion that command
> number is a convenient way of identifying prior commands. It seems like
> an idea that should have gone out with punched cards.
>
Command-numbers are the point-and-click equivalent for mouse-less users :)

Well... sometimes I can remember the pattern of something I wrote some
(for the sake of the argument a few hundred ) commands ago, but nothing
verbatim.
Seeing the full history (with large scrollback buffer in the console
app), I quickly spot the command I need.

I could at that time just as easily see, that number 317 would refer to
that command, and I wish to load that number in my editor.

I would really hate to have to backstep a few hundred commands, or
reverse search if I have nothing specific enough to search for (say the
last 50 commands where all alike - sorta the same tables and columns).

btw. Readline has history too..
http://tiswww.case.edu/~chet/readline/history.html

+1 from a lurking user :)

Svenne


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 22:56:46
Message-ID: 15347.1165359406@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> !46 seems awful easy to me.

[ shrug... ] Obviously you've learned a different way of doing things.
I suppose there's no point in telling you that another way is better
when you're happy with the one that's already wired into your fingertips.

The main objection I have to the proposal other than not having a use
for it myself is that adding line numbers to \s output destroys the
usefulness of \s for any other purpose than the one you propose. In
particular, you could no longer take a chunk of it and put it into a SQL
script without doing a lot of tedious (and mistake-prone) editing to get
rid of the numbers. Since that's the only use I've ever had for \s, I'm
not happy about losing it.

> Worse yet... what if it is actually query 27 because I got distracted by
> a support question over jabber from the customer I am actually working
> on and I need to help him profile a query for a couple of minutes?

Isn't that an argument *against* using numbers for this?

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:03:38
Message-ID: 15449.1165359818@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> Yeah the # was the next logical thing. Would we have to escape it?

Yes. You can't take over either of those characters standalone.

regards, tom lane


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:05:01
Message-ID: 1165359901.31648.96.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 17:56 -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > !46 seems awful easy to me.
>
> [ shrug... ] Obviously you've learned a different way of doing things.
> I suppose there's no point in telling you that another way is better
> when you're happy with the one that's already wired into your fingertips.

It took me forever to stop putting -print at the end of find ;)

>
> The main objection I have to the proposal other than not having a use
> for it myself is that adding line numbers to \s output destroys the
> usefulness of \s for any other purpose than the one you propose. In
> particular, you could no longer take a chunk of it and put it into a SQL
> script without doing a lot of tedious (and mistake-prone) editing to get
> rid of the numbers. Since that's the only use I've ever had for \s, I'm
> not happy about losing it.

O.k. what about \s# ? Or something like that... Where \s is the good old
fashioned way, and \s# is my new fandango way?

>
> > Worse yet... what if it is actually query 27 because I got distracted by
> > a support question over jabber from the customer I am actually working
> > on and I need to help him profile a query for a couple of minutes?
>
> Isn't that an argument *against* using numbers for this?

No because I can review my \s, review my list and then begin where I
left off with a simple !27.

Sincerely,

Joshua D. Drake

>
> regards, tom lane
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:07:27
Message-ID: 1165360047.31648.101.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 15:05 -0800, Joshua D. Drake wrote:
> On Tue, 2006-12-05 at 17:56 -0500, Tom Lane wrote:
> > "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > > !46 seems awful easy to me.
> >
> > [ shrug... ] Obviously you've learned a different way of doing things.
> > I suppose there's no point in telling you that another way is better
> > when you're happy with the one that's already wired into your fingertips.
>
> It took me forever to stop putting -print at the end of find ;)

I am all for a better way and perhaps I am missing something but I do
not see a better way for what I am trying to do. I have no problem
learning and frankly if you know a better way, other people on this
thread I am sure want to hear it.

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Jeremy Drake <pgsql(at)jdrake(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql possible TODO
Date: 2006-12-05 23:07:44
Message-ID: Pine.BSO.4.64.0612051504300.28611@resin.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 5 Dec 2006, Joshua D. Drake wrote:

>
> > > > Just like bash.
> > >
> > > What we have is just like bash --- at least the parts of it that I use.
> >
> > This reminds me of the old csh function where you could recall things by
> > numbers and do search/replace on them. The capability was so hard to
> > use I could imagine anyone _normal_ using it.
>
> Except that this has nothing to do with that. This is *standard* feature
> set for the unix shell:
>
> 804 history
> 805 joe bin/starttest.sh
> 806 history
>
> Oh... that's right, its call starttest.sh:
>
> !805
>
> Except for PostgreSQL it would be:
>
> postgres=# \s
>
> 1 SELECT * from cmd_pg_stat_all_tables ;
> 2 SELECT count(*) from cmd_pg_stat_all_tables ;
> 3 SELECT count(*) from cmd_pg_stat_database;
>
> postgres=# !1
>

Make sure if you do this you support the other variant. Ie, in bash
instead of !806 you could have said !-2, which is execute the second to
last command.

And how about
$ ls *.foo
...
$ ^ls^rm

?

:)

>
> Sincerely,
>
> Joshua D. Drake
>
>
>
>
> >
>

--
Economics is extremely useful as a form of employment for economists.
-- John Kenneth Galbraith


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:08:57
Message-ID: 15537.1165360137@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> O.k. what about \s# ? Or something like that... Where \s is the good old
> fashioned way, and \s# is my new fandango way?

That's got a meaning already (any argument to \s is the file name to write).

I suppose that if you didn't mind making the command behave
non-orthogonally, you could have "\s" print line numbers while
"\s file" doesn't. Not sure if that's a good idea or not ...

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:10:49
Message-ID: 200612052310.kB5NAn106940@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Joshua D. Drake wrote:
> On Tue, 2006-12-05 at 17:45 -0500, Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Tom Lane wrote:
> > > > "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > > > > control-R isn't real useful for 17 queries that are exactly the same
> > > > > except for 3 different join clauses. It also isn't useful when you don't
> > > > > know exactly what query you are looking for.
> > > >
> > > > ... but, somehow, you know exactly what command number it has?
> > >
> > > Well, presumably \s would give you the numbers. "history" does on bash anyway.
> > >
> > > I use it on bash all the time: I do "history | grep something" and then
> > > !<number of command I want>.
> > >
> > > I don't think we can do the "| grep" part, but it's useful anyway.
> >
> > OK, now at least I understand how it would be used, and could be
> > explained easily in the documentation --- do \s, then \! 99, or maybe \#
> > 99. I don't like making \! do shells and pull SQL commands from history.
>
> Yeah the # was the next logical thing. Would we have to escape it?
>
> \#12... hmmm
> #12

Well, it is something that controls psql, so the backslash really makes
sense.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: David Fetter <david(at)fetter(dot)org>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:27:17
Message-ID: 20061205232717.GC872@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 02:50:47PM -0800, Joshua D. Drake wrote:
> On Tue, 2006-12-05 at 17:45 -0500, Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Tom Lane wrote:
> > > > "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > > > > control-R isn't real useful for 17 queries that are exactly
> > > > > the same except for 3 different join clauses. It also isn't
> > > > > useful when you don't know exactly what query you are
> > > > > looking for.

I'd argue that you need to have those 17 queries each in different
files, or you're cruisin' for a bruisin'.

> > > > ... but, somehow, you know exactly what command number it has?
> > >
> > > Well, presumably \s would give you the numbers. "history" does
> > > on bash anyway.
> > >
> > > I use it on bash all the time: I do "history | grep something"
> > > and then !<number of command I want>.
> > >
> > > I don't think we can do the "| grep" part, but it's useful
> > > anyway.
> >
> > OK, now at least I understand how it would be used, and could be
> > explained easily in the documentation --- do \s, then \! 99, or
> > maybe \# 99. I don't like making \! do shells and pull SQL
> > commands from history.
>
> Yeah the # was the next logical thing. Would we have to escape it?
>
> \#12... hmmm
> #12

\#12 fits better into psql's paradigm.

Cheers,
D

#9
#9
#9

;)
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!


From: Richard Troy <rtroy(at)ScienceTools(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql possible TODO
Date: 2006-12-05 23:41:58
Message-ID: Pine.LNX.4.33.0612051539230.27353-100000@denzel.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Tue, 5 Dec 2006, Tom Lane wrote:
>
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > O.k. what about \s# ? Or something like that... Where \s is the good old
> > fashioned way, and \s# is my new fandango way?
>
> That's got a meaning already (any argument to \s is the file name to write).
>
> I suppose that if you didn't mind making the command behave
> non-orthogonally, you could have "\s" print line numbers while
> "\s file" doesn't. Not sure if that's a good idea or not ...

Hi Tom, Josh,

Frankly, I don't care about this much, though I tend to lean _against_
numbered querys, however, it occurs to me that perhaps Josh can implement
a command line switch to turn on command line numbering. He gets what he
wants, you get what you want, and the world has a tiny bit more
functionality. It seems to me foolish to change what exists today, but
_adding_ an option seems reasonable if someone wants to impelent it.

Rgds,
Richard

--
Richard Troy, Chief Scientist
Science Tools Corporation
510-924-1363 or 202-747-1263
rtroy(at)ScienceTools(dot)com, http://ScienceTools.com/


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-05 23:45:07
Message-ID: 1165362307.31648.107.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 15:27 -0800, David Fetter wrote:
> On Tue, Dec 05, 2006 at 02:50:47PM -0800, Joshua D. Drake wrote:
> > On Tue, 2006-12-05 at 17:45 -0500, Bruce Momjian wrote:
> > > Alvaro Herrera wrote:
> > > > Tom Lane wrote:
> > > > > "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > > > > > control-R isn't real useful for 17 queries that are exactly
> > > > > > the same except for 3 different join clauses. It also isn't
> > > > > > useful when you don't know exactly what query you are
> > > > > > looking for.
>
> I'd argue that you need to have those 17 queries each in different
> files, or you're cruisin' for a bruisin'.

Not sure that's the case but...

> > > OK, now at least I understand how it would be used, and could be
> > > explained easily in the documentation --- do \s, then \! 99, or
> > > maybe \# 99. I don't like making \! do shells and pull SQL
> > > commands from history.
> >
> > Yeah the # was the next logical thing. Would we have to escape it?
> >
> > \#12... hmmm
> > #12
>
> \#12 fits better into psql's paradigm.
>

nod.

j

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Troy <rtroy(at)ScienceTools(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:03:07
Message-ID: 15976.1165363387@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Richard Troy <rtroy(at)ScienceTools(dot)com> writes:
> ... it occurs to me that perhaps Josh can implement
> a command line switch to turn on command line numbering.

That would solve the problem I have with changing \s. I think a psql
\set variable (comparable to ON_ERROR_STOP and friends) might be the way
to go instead of inventing another \-command, but it's not real
important.

regards, tom lane


From: mark(at)mark(dot)mielke(dot)cc
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:09:02
Message-ID: 20061206000902.GA25579@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 05:30:03PM -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > control-R isn't real useful for 17 queries that are exactly the same
> > except for 3 different join clauses. It also isn't useful when you don't
> > know exactly what query you are looking for.
> ... but, somehow, you know exactly what command number it has?
> The above seems completely unimpressive as arguments for adding
> command-number-based recall.

> >> What we have is just like bash --- at least the parts of it that I use.
> > Yes, and I am trying to add more functionality that is like bash :)
> It's like a part of bash that's been obsolete since readline was
> written, and probably would never have existed at all if readline had
> appeared first. I can't really picture a situation in which this is an
> improvement over the readline facilities.

My two cents: I've a heavy command line user. I have very strong demands
on my command recall capabilities. I find control-P to be the single most
useful keystroke in my repertoire. Command number recall *never* makes my
list. The zsh feature that lets me edit multi-line commands is a major
hit with me. Control-R, if incremental, works quite well, although that
isn't usually the case either.

People I work with use command number recall. The same people who never
fix their shell from csh to bash/zsh. The people who use the same thing
they first learned to use over a decade ago. A few of them even type 'h'
to see their history, then switch over to the mouse to cut + paste the
command - and if the line extends across multiple lines, they do multiple
cut + paste operations, because they are not confident in understanding
whether the lines are line-wrapped, or newline terminated.

Allowing these people to live in the dark ages doesn't appeal to me.
Certainly not if it takes effort to do so. :-)

I don't buy it either.

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: mark(at)mark(dot)mielke(dot)cc
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:12:41
Message-ID: 20061206001241.GB25579@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 02:46:54PM -0800, Joshua D. Drake wrote:
> Imagine that you are profiling 50 queries, the queries are all the same
> except for varying where clauses or joins.

Put them in a file.

Anything worth spending that much time on, is probably worth keeping,
such that it can be reproduced later.

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:15:05
Message-ID: 1165364105.31648.115.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> Allowing these people to live in the dark ages doesn't appeal to me.
> Certainly not if it takes effort to do so. :-)

Funny no one has yet to offer a better alternative, they just keep
saying my way is better. Sounds a bit like emacs vs. vi to me.

ctrl-p is great for a single command. It sucks if you look at my
workload which I have outlined previously in this thread. I also
mentioned explictly why ctrl-r won't work for this particular case.

I also said, show me a better way (I am happy to learn) and you haven't
done that either.

Your work load does not apply to my work load, nor the workload of
others on this list who have already gave a +1.

I was quite serious, if someone can illustrate a more efficient way I
will gladly RTFM on that way and drop the whole thing.

Suncerely,

Joshua D. Drake

>
> I don't buy it either.
>
> Cheers,
> mark
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:16:59
Message-ID: 1165364219.31648.117.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 19:12 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> On Tue, Dec 05, 2006 at 02:46:54PM -0800, Joshua D. Drake wrote:
> > Imagine that you are profiling 50 queries, the queries are all the same
> > except for varying where clauses or joins.
>
> Put them in a file.

You mean like the file that psql is nice enough to provide for
me? .psql_history?

>
> Anything worth spending that much time on, is probably worth keeping,
> such that it can be reproduced later.

When it is production yes... it goes into a view or svn depending on
what it is doing.

Joshua D. Drake

>
> Cheers,
> mark
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: mark(at)mark(dot)mielke(dot)cc
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:17:11
Message-ID: 20061206001711.GC25579@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 04:15:05PM -0800, Joshua D. Drake wrote:
> > Allowing these people to live in the dark ages doesn't appeal to me.
> > Certainly not if it takes effort to do so. :-)
> Funny no one has yet to offer a better alternative, they just keep
> saying my way is better. Sounds a bit like emacs vs. vi to me.
>
> ctrl-p is great for a single command. It sucks if you look at my
> workload which I have outlined previously in this thread. I also
> mentioned explictly why ctrl-r won't work for this particular case.
>
> I also said, show me a better way (I am happy to learn) and you haven't
> done that either.
>
> Your work load does not apply to my work load, nor the workload of
> others on this list who have already gave a +1.
>
> I was quite serious, if someone can illustrate a more efficient way I
> will gladly RTFM on that way and drop the whole thing.

You are saying that typing in 50 commands by hand, adjusting it each time,
is efficient?

I've done what you are suggesting - I think - I do it with a file. I
type "psql -f <filename>". I run it as many times as required.

Other times, I keep the 50 command lines in an XEmacs session, and I
cut + paste whole paragraphs from XEmacs to psql.

By doing this - my work is saved.

psql is not an editor session. It will never be an editor session. It
will always be a command line. Trying to treat it as an editor session
sounds like torture. Augh. :-)

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:29:24
Message-ID: 1165364965.31648.127.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> Allowing these people to live in the dark ages doesn't appeal to me.
> Certainly not if it takes effort to do so. :-)

And just so were clear... You can not serious suggest that my way is
Dark Ages if you are running XEmacs ;)

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:33:55
Message-ID: 1165365235.31648.130.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,

O.k. this is my currently thinking:

\# will list just like \s except it will include line numbers:

1 SELECT * FROM FOO; (not a tab of course)
2 UPDATE bar SET foo = 6;

\# 2 will execute query number 2
\#e 2 will open the numbered query in $EDITOR

I would love to figure out a way to auto explain these queries without
obnoxious syntax. Any ideas?

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Richard Troy <rtroy(at)ScienceTools(dot)com>
Cc: mark(at)mark(dot)mielke(dot)cc, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 00:39:04
Message-ID: 1165365544.31648.132.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 16:47 -0800, Richard Troy wrote:
> On Tue, 5 Dec 2006, Joshua D. Drake wrote:
> >
> > Funny no one has yet to offer a better alternative,
>
> -snip-
>
> I thought I did. The toolset can be updated to include a switch that give
> you what you want without destroying what exists today.

My complaint certainly wasn't at you, your suggestion was perfectly
valid.

>
> > I was quite serious, if someone can illustrate a more efficient way I
> > will gladly RTFM on that way and drop the whole thing.
>
> Short of that happening, my suggestion is; get coding, brother!

Plan on it :)

> If you
> want it and you can't convince everyone else your way is better, then it
> seems to me you have a great choice; implement it yourself

Well of course not... we are hearding cats afterall. I would however
like to get a idea from the people who have said they would like such a
feature of what type of syntax they would like.

> and then share
> it with everyone else! ...Or, did you expect someone else to step in and
> do your coding for you? -smile-

I just pay people to do that when needed. ;)

Sincerely,

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Richard Troy <rtroy(at)ScienceTools(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: <mark(at)mark(dot)mielke(dot)cc>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql possible TODO
Date: 2006-12-06 00:47:14
Message-ID: Pine.LNX.4.33.0612051643170.27353-100000@denzel.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On Tue, 5 Dec 2006, Joshua D. Drake wrote:
>
> Funny no one has yet to offer a better alternative,

-snip-

I thought I did. The toolset can be updated to include a switch that give
you what you want without destroying what exists today.

> I was quite serious, if someone can illustrate a more efficient way I
> will gladly RTFM on that way and drop the whole thing.

Short of that happening, my suggestion is; get coding, brother! If you
want it and you can't convince everyone else your way is better, then it
seems to me you have a great choice; implement it yourself and then share
it with everyone else! ...Or, did you expect someone else to step in and
do your coding for you? -smile-

Richard

--
Richard Troy, Chief Scientist
Science Tools Corporation
510-924-1363 or 202-747-1263
rtroy(at)ScienceTools(dot)com, http://ScienceTools.com/


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 01:56:42
Message-ID: 1165370202.31658.25.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 19:09 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> My two cents: I've a heavy command line user. I have very strong demands
> on my command recall capabilities. I find control-P to be the single most
> useful keystroke in my repertoire. Command number recall *never* makes my
> list. The zsh feature that lets me edit multi-line commands is a major

I think I would find number recall more useful in psql than CLI. I think
it would be useful for analyzing query plans, and I think that's what
Joshua is talking about.

The cycle goes something like this:

(1) switch enable_* variables on or off, change indexes around, modify
user defined functions, or anything else that might affect a query that
you need to run
(2) run one or more queries that you remember by number, and see the
runtimes, explain, or explain analyze of each.
(3) Goto 1

I would rarely use this feature, but if it was around and required a few
simple keystrokes (and didn't interfere with anything else), it would be
very helpful when I get involved in one of these trial-and-error cycles.

Regards,
Jeff Davis


From: mark(at)mark(dot)mielke(dot)cc
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 02:03:18
Message-ID: 20061206020318.GA29073@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 04:29:24PM -0800, Joshua D. Drake wrote:
> > Allowing these people to live in the dark ages doesn't appeal to me.
> > Certainly not if it takes effort to do so. :-)
> And just so were clear... You can not serious suggest that my way is
> Dark Ages if you are running XEmacs ;)

Sure I can. Find me an editor better than XEmacs. Have fun trying.

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: mark(at)mark(dot)mielke(dot)cc
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 02:08:37
Message-ID: 1165370917.31648.135.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 21:03 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> On Tue, Dec 05, 2006 at 04:29:24PM -0800, Joshua D. Drake wrote:
> > > Allowing these people to live in the dark ages doesn't appeal to me.
> > > Certainly not if it takes effort to do so. :-)
> > And just so were clear... You can not serious suggest that my way is
> > Dark Ages if you are running XEmacs ;)
>
> Sure I can. Find me an editor better than XEmacs. Have fun trying.

I wouldn't even bother, I prefer to be productive then use Dark Ages
technology ;)

>
> Cheers,
> mark
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: mark(at)mark(dot)mielke(dot)cc
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 02:39:20
Message-ID: 20061206023920.GA30401@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 06:08:37PM -0800, Joshua D. Drake wrote:
> On Tue, 2006-12-05 at 21:03 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> > On Tue, Dec 05, 2006 at 04:29:24PM -0800, Joshua D. Drake wrote:
> > > > Allowing these people to live in the dark ages doesn't appeal to me.
> > > > Certainly not if it takes effort to do so. :-)
> > > And just so were clear... You can not serious suggest that my way is
> > > Dark Ages if you are running XEmacs ;)
> > Sure I can. Find me an editor better than XEmacs. Have fun trying.
> I wouldn't even bother, I prefer to be productive then use Dark Ages
> technology ;)

Productive by using psql command-line to enter 50+ statements? :-)

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: mark(at)mark(dot)mielke(dot)cc
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 02:56:35
Message-ID: 45763163.9040108@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

mark(at)mark(dot)mielke(dot)cc wrote:

>
> You are saying that typing in 50 commands by hand, adjusting it each time,
> is efficient?
>
> I've done what you are suggesting - I think - I do it with a file. I
> type "psql -f <filename>". I run it as many times as required.
>
> Other times, I keep the 50 command lines in an XEmacs session, and I
> cut + paste whole paragraphs from XEmacs to psql.
>
> By doing this - my work is saved.
>
> psql is not an editor session. It will never be an editor session. It
> will always be a command line. Trying to treat it as an editor session
> sounds like torture. Augh. :-)
>

FWIW I tend to use a similar method to this - 'cept the editor is
usually vim instead of emacs...err..oh dear, emacs vs vi here we come...:-).

Cheers

Mark


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: mark(at)mark(dot)mielke(dot)cc, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 03:25:21
Message-ID: 17420.1165375521@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> On Tue, 2006-12-05 at 19:12 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
>> Put them in a file.

> You mean like the file that psql is nice enough to provide for
> me? .psql_history?

.psql_history *used* to be useful for such things, until someone screwed
it up with ^A for newlines ... now you need to edit it. Still, that's
a simpler fix than removing line numbers would be.

regards, tom lane


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: mark(at)mark(dot)mielke(dot)cc, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 03:50:51
Message-ID: 1165377051.20753.0.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, 2006-12-05 at 22:25 -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd(at)commandprompt(dot)com> writes:
> > On Tue, 2006-12-05 at 19:12 -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> >> Put them in a file.
>
> > You mean like the file that psql is nice enough to provide for
> > me? .psql_history?
>
> .psql_history *used* to be useful for such things, until someone screwed
> it up with ^A for newlines ... now you need to edit it. Still, that's
> a simpler fix than removing line numbers would be.

.bash_history does not actually contain the numbers. I would not expect
that .psql_history would either. ^A for new lines? Huh?

Sincerely,

Joshua D. Drake

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: You can help support the PostgreSQL project by donating at
>
> http://www.postgresql.org/about/donate
>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Stephen Harris <lists(at)spuddy(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 04:41:06
Message-ID: 20061206044106.GA1955@pugwash.spuddy.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 05:34:58PM -0500, Tom Lane wrote:
> Stephen Harris <lists(at)spuddy(dot)org> writes:
> > Silly: You could even do \r xyz and load the buffer with the last line
> > beginning xyz
>
> We've got that: control-R xyz.

Not quite. "Beginning" is the difference. It's subtle and, as I said,
a silly idea. I was just taking the idea of history recall and applying
the ksh syntax to our commands line :-)

> The thing I'm having a hard time with here is the notion that command
> number is a convenient way of identifying prior commands. It seems like
> an idea that should have gone out with punched cards.

I've been a Unix SA for 16 years now and recalling commands by number is
still a convenient thing, especially when you have 2 or 3 multi-line
statements which are 90% the same.

--

rgds
Stephen


From: Stephen Harris <lists(at)spuddy(dot)org>
To: mark(at)mark(dot)mielke(dot)cc
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 04:46:52
Message-ID: 20061206044652.GB1955@pugwash.spuddy.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 09:03:18PM -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> Sure I can. Find me an editor better than XEmacs. Have fun trying.

"ed". Xemacs doesn't work on my vt-compatible terminal console. Sucks.

I didn't realise this list was for editor wars. Silly me.

--

rgds
Stephen


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Harris <lists(at)spuddy(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 05:33:59
Message-ID: 18554.1165383239@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stephen Harris <lists(at)spuddy(dot)org> writes:
> On Tue, Dec 05, 2006 at 05:34:58PM -0500, Tom Lane wrote:
>> Stephen Harris <lists(at)spuddy(dot)org> writes:
>>> Silly: You could even do \r xyz and load the buffer with the last line
>>> beginning xyz
>>
>> We've got that: control-R xyz.

> Not quite. "Beginning" is the difference.

True, but upthread it was suggested that sometimes one might like to
search for critical difference-making strings that were *not* the first
thing in the command ... so somehow I'm not finding a forced line-start
anchor to be a net plus.

> I've been a Unix SA for 16 years now and recalling commands by number is
> still a convenient thing, especially when you have 2 or 3 multi-line
> statements which are 90% the same.

Indeed. The part of this that I still don't buy is where the easiest
way to distinguish among those statements is an artificial command
number.

Still, it seems we've reduced this to an emacs-vs-vi type argument where
what you're used to is the only thing that counts. As long as the patch
isn't unduly ugly/invasive and doesn't break any existing usages, I
won't complain about it.

regards, tom lane


From: mark(at)mark(dot)mielke(dot)cc
To: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 06:17:30
Message-ID: 20061206061730.GA2977@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Dec 06, 2006 at 03:56:35PM +1300, Mark Kirkwood wrote:
> mark(at)mark(dot)mielke(dot)cc wrote:
> >You are saying that typing in 50 commands by hand, adjusting it each time,
> >is efficient?
> >
> >I've done what you are suggesting - I think - I do it with a file. I
> >type "psql -f <filename>". I run it as many times as required.
> >
> >Other times, I keep the 50 command lines in an XEmacs session, and I
> >cut + paste whole paragraphs from XEmacs to psql.
> >
> >By doing this - my work is saved.
> >
> >psql is not an editor session. It will never be an editor session. It
> >will always be a command line. Trying to treat it as an editor session
> >sounds like torture. Augh. :-)
>
> FWIW I tend to use a similar method to this - 'cept the editor is
> usually vim instead of emacs...err..oh dear, emacs vs vi here we come...:-).

Oh no no no...

XEmacs and VIM are both better than command line for anything longer than
a few lines...

Editor? Command line. Hmm... Let me think which will be most productive
for 50 statements that are similar... :-)

Cheers,
mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: mark(at)mark(dot)mielke(dot)cc
To: Stephen Harris <lists(at)spuddy(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 06:19:25
Message-ID: 20061206061925.GB2977@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Dec 05, 2006 at 11:46:52PM -0500, Stephen Harris wrote:
> On Tue, Dec 05, 2006 at 09:03:18PM -0500, mark(at)mark(dot)mielke(dot)cc wrote:
> > Sure I can. Find me an editor better than XEmacs. Have fun trying.
> "ed". Xemacs doesn't work on my vt-compatible terminal console. Sucks.

Yes it does. I used XEmacs on a DEC VT100 many moons ago. It's all about
the terminfo setting... :-)

> I didn't realise this list was for editor wars. Silly me.

It's a silly break that will have to end soon... :-)

Back to your regular scheduled monotony... Hehe....

mark

--
mark(at)mielke(dot)cc / markm(at)ncf(dot)ca / markm(at)nortel(dot)com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...

http://mark.mielke.cc/


From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "Stephen Harris" <lists(at)spuddy(dot)org>
Cc: mark(at)mark(dot)mielke(dot)cc, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-06 06:57:17
Message-ID: 2083.24.211.165.134.1165388237.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Stephen Harris wrote:
> On Tue, Dec 05, 2006 at 09:03:18PM -0500, mark(at)mark(dot)mielke(dot)cc wrote:
>> Sure I can. Find me an editor better than XEmacs. Have fun trying.
>
> "ed". Xemacs doesn't work on my vt-compatible terminal console. Sucks.
>
> I didn't realise this list was for editor wars. Silly me.
>

Try the -nw switch with both emacs and xemacs - they will work nicely in
pretty much any terminal window. :-)

cheers

andrew


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Troy <rtroy(at)ScienceTools(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-29 23:54:20
Message-ID: 20061229235420.GC32000@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tom Lane wrote:
> Richard Troy <rtroy(at)ScienceTools(dot)com> writes:
> > ... it occurs to me that perhaps Josh can implement
> > a command line switch to turn on command line numbering.
>
> That would solve the problem I have with changing \s. I think a psql
> \set variable (comparable to ON_ERROR_STOP and friends) might be the way
> to go instead of inventing another \-command, but it's not real
> important.

So, is anybody working on this? I think it should be put in the TODO
list:

- Allow psql to display item numbers along each history item, depending
on a \set variable

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Troy <rtroy(at)ScienceTools(dot)com>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-30 01:59:34
Message-ID: 200612300159.kBU1xYb04001@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Tom Lane wrote:
> > Richard Troy <rtroy(at)ScienceTools(dot)com> writes:
> > > ... it occurs to me that perhaps Josh can implement
> > > a command line switch to turn on command line numbering.
> >
> > That would solve the problem I have with changing \s. I think a psql
> > \set variable (comparable to ON_ERROR_STOP and friends) might be the way
> > to go instead of inventing another \-command, but it's not real
> > important.
>
> So, is anybody working on this? I think it should be put in the TODO
> list:
>
> - Allow psql to display item numbers along each history item, depending
> on a \set variable

I thought Joshua Drake was going to submit a patch, but if doesn't
appear shortly, I will add it to the TODO list with the agreed API.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Troy <rtroy(at)ScienceTools(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2006-12-30 02:30:21
Message-ID: 1167445821.20777.32.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 2006-12-29 at 20:59 -0500, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Tom Lane wrote:
> > > Richard Troy <rtroy(at)ScienceTools(dot)com> writes:
> > > > ... it occurs to me that perhaps Josh can implement
> > > > a command line switch to turn on command line numbering.
> > >
> > > That would solve the problem I have with changing \s. I think a psql
> > > \set variable (comparable to ON_ERROR_STOP and friends) might be the way
> > > to go instead of inventing another \-command, but it's not real
> > > important.
> >
> > So, is anybody working on this? I think it should be put in the TODO
> > list:
> >
> > - Allow psql to display item numbers along each history item, depending
> > on a \set variable
>
> I thought Joshua Drake was going to submit a patch, but if doesn't
> appear shortly, I will add it to the TODO list with the agreed API.

I will claim this for now. I will let it go if I can't get at least
something productive done on it by end of January.

Joshua D. Drake

>
--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Troy <rtroy(at)ScienceTools(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-01-29 17:30:33
Message-ID: 20070129173033.GP14134@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Joshua D. Drake wrote:
> On Fri, 2006-12-29 at 20:59 -0500, Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Tom Lane wrote:
> > > > Richard Troy <rtroy(at)ScienceTools(dot)com> writes:
> > > > > ... it occurs to me that perhaps Josh can implement
> > > > > a command line switch to turn on command line numbering.
> > > >
> > > > That would solve the problem I have with changing \s. I think a psql
> > > > \set variable (comparable to ON_ERROR_STOP and friends) might be the way
> > > > to go instead of inventing another \-command, but it's not real
> > > > important.
> > >
> > > So, is anybody working on this? I think it should be put in the TODO
> > > list:
> > >
> > > - Allow psql to display item numbers along each history item, depending
> > > on a \set variable
> >
> > I thought Joshua Drake was going to submit a patch, but if doesn't
> > appear shortly, I will add it to the TODO list with the agreed API.
>
> I will claim this for now. I will let it go if I can't get at least
> something productive done on it by end of January.

Now that the embargo period seems to be over, I think it would be a good
time to add it to the TODO list. Also, I'd modify the idea slightly to
allow a more general facility, using %-escapes (or similar) for line
numbers, dates and so on. Bash allows something like this (albeit
limited to only times) using the HISTTIMEFORMAT environment variable.

This is the first case I know of of an embargo to an agreed TODO item.
Why was it put in place? I find it distracting, because the item has to
be put on someone else's TODO list and then that person has to pinch
others to get it added to the central TODO list. Not sure I see the
point. (I understand about bashing Joshua ---a sport I also practice in
Command Prompt's internal lists ;-) --- but in this case it seems to be
counterproductive).

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Troy <rtroy(at)ScienceTools(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-01-29 21:54:41
Message-ID: 200701292154.l0TLsfd06504@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


It is actually still in my mailbox to be added to TODO when I get up to it.

---------------------------------------------------------------------------

Alvaro Herrera wrote:
> Joshua D. Drake wrote:
> > On Fri, 2006-12-29 at 20:59 -0500, Bruce Momjian wrote:
> > > Alvaro Herrera wrote:
> > > > Tom Lane wrote:
> > > > > Richard Troy <rtroy(at)ScienceTools(dot)com> writes:
> > > > > > ... it occurs to me that perhaps Josh can implement
> > > > > > a command line switch to turn on command line numbering.
> > > > >
> > > > > That would solve the problem I have with changing \s. I think a psql
> > > > > \set variable (comparable to ON_ERROR_STOP and friends) might be the way
> > > > > to go instead of inventing another \-command, but it's not real
> > > > > important.
> > > >
> > > > So, is anybody working on this? I think it should be put in the TODO
> > > > list:
> > > >
> > > > - Allow psql to display item numbers along each history item, depending
> > > > on a \set variable
> > >
> > > I thought Joshua Drake was going to submit a patch, but if doesn't
> > > appear shortly, I will add it to the TODO list with the agreed API.
> >
> > I will claim this for now. I will let it go if I can't get at least
> > something productive done on it by end of January.
>
> Now that the embargo period seems to be over, I think it would be a good
> time to add it to the TODO list. Also, I'd modify the idea slightly to
> allow a more general facility, using %-escapes (or similar) for line
> numbers, dates and so on. Bash allows something like this (albeit
> limited to only times) using the HISTTIMEFORMAT environment variable.
>
> This is the first case I know of of an embargo to an agreed TODO item.
> Why was it put in place? I find it distracting, because the item has to
> be put on someone else's TODO list and then that person has to pinch
> others to get it added to the central TODO list. Not sure I see the
> point. (I understand about bashing Joshua ---a sport I also practice in
> Command Prompt's internal lists ;-) --- but in this case it seems to be
> counterproductive).
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Troy <rtroy(at)ScienceTools(dot)com>, Stephen Harris <lists(at)spuddy(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-01-29 21:56:00
Message-ID: 200701292156.l0TLu0c06655@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> > I will claim this for now. I will let it go if I can't get at least
> > something productive done on it by end of January.
>
> Now that the embargo period seems to be over, I think it would be a good
> time to add it to the TODO list. Also, I'd modify the idea slightly to
> allow a more general facility, using %-escapes (or similar) for line
> numbers, dates and so on. Bash allows something like this (albeit
> limited to only times) using the HISTTIMEFORMAT environment variable.
>
> This is the first case I know of of an embargo to an agreed TODO item.
> Why was it put in place? I find it distracting, because the item has to
> be put on someone else's TODO list and then that person has to pinch
> others to get it added to the central TODO list. Not sure I see the
> point. (I understand about bashing Joshua ---a sport I also practice in
> Command Prompt's internal lists ;-) --- but in this case it seems to be
> counterproductive).

The only reason it isn't on the TODO is because I am still catching up
for the 8.3 queue. I know of no embargo.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-04 01:51:08
Message-ID: 200702040151.l141p8b20032@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


Added to TODO:

o Add \# to list command history like \s, but with line numbers

http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php

---------------------------------------------------------------------------

Joshua D. Drake wrote:
> Hello,
>
> O.k. this is my currently thinking:
>
> \# will list just like \s except it will include line numbers:
>
> 1 SELECT * FROM FOO; (not a tab of course)
> 2 UPDATE bar SET foo = 6;
>
> \# 2 will execute query number 2
> \#e 2 will open the numbered query in $EDITOR
>
> I would love to figure out a way to auto explain these queries without
> obnoxious syntax. Any ideas?
>
>
> Sincerely,
>
> Joshua D. Drake
>
>
> --
>
> === The PostgreSQL Company: Command Prompt, Inc. ===
> Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
> Providing the most comprehensive PostgreSQL solutions since 1997
> http://www.commandprompt.com/
>
> Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 15:49:13
Message-ID: 20070205154913.GC4092@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
>
> Added to TODO:
>
> o Add \# to list command history like \s, but with line numbers
>
> http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php

Humm, this is not what we agreed.

> ---------------------------------------------------------------------------
>
> Joshua D. Drake wrote:
> > Hello,
> >
> > O.k. this is my currently thinking:
> >
> > \# will list just like \s except it will include line numbers:
> >
> > 1 SELECT * FROM FOO; (not a tab of course)
> > 2 UPDATE bar SET foo = 6;
> >
> > \# 2 will execute query number 2
> > \#e 2 will open the numbered query in $EDITOR
> >
> > I would love to figure out a way to auto explain these queries without
> > obnoxious syntax. Any ideas?

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


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 16:49:16
Message-ID: 45C7600C.5080406@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Bruce Momjian wrote:
>> Added to TODO:
>>
>> o Add \# to list command history like \s, but with line numbers
>>
>> http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
>
> Humm, this is not what we agreed.

Actually to be fair, there was no agreement. However, I do think it is
not worthwhile to be a TODO (thank you anyway Bruce).

I am not going to be spending my time on it and I doubt anyone else will.

Joshua D. Drake

>
>
>> ---------------------------------------------------------------------------
>>
>> Joshua D. Drake wrote:
>>> Hello,
>>>
>>> O.k. this is my currently thinking:
>>>
>>> \# will list just like \s except it will include line numbers:
>>>
>>> 1 SELECT * FROM FOO; (not a tab of course)
>>> 2 UPDATE bar SET foo = 6;
>>>
>>> \# 2 will execute query number 2
>>> \#e 2 will open the numbered query in $EDITOR
>>>
>>> I would love to figure out a way to auto explain these queries without
>>> obnoxious syntax. Any ideas?
>
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 16:49:42
Message-ID: 200702051649.l15GngN11784@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Bruce Momjian wrote:
> >
> > Added to TODO:
> >
> > o Add \# to list command history like \s, but with line numbers
> >
> > http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
>
> Humm, this is not what we agreed.

Are you saying the URL is wrong or the description?

I have updated the item description to:

o Add \# to list and execute command history

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 16:52:13
Message-ID: 200702051652.l15GqDO07734@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Joshua D. Drake wrote:
> Alvaro Herrera wrote:
> > Bruce Momjian wrote:
> >> Added to TODO:
> >>
> >> o Add \# to list command history like \s, but with line numbers
> >>
> >> http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
> >
> > Humm, this is not what we agreed.
>
> Actually to be fair, there was no agreement. However, I do think it is
> not worthwhile to be a TODO (thank you anyway Bruce).
>
> I am not going to be spending my time on it and I doubt anyone else will.

Really, I thought there were a number of people who liked it. New text
is:

o Add \# to list and execute command history

Are you sure you want it removed?

---------------------------------------------------------------------------

>
> Joshua D. Drake
>
> >
> >
> >> ---------------------------------------------------------------------------
> >>
> >> Joshua D. Drake wrote:
> >>> Hello,
> >>>
> >>> O.k. this is my currently thinking:
> >>>
> >>> \# will list just like \s except it will include line numbers:
> >>>
> >>> 1 SELECT * FROM FOO; (not a tab of course)
> >>> 2 UPDATE bar SET foo = 6;
> >>>
> >>> \# 2 will execute query number 2
> >>> \#e 2 will open the numbered query in $EDITOR
> >>>
> >>> I would love to figure out a way to auto explain these queries without
> >>> obnoxious syntax. Any ideas?
> >
> >
>
>
> --
>
> === The PostgreSQL Company: Command Prompt, Inc. ===
> Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
> Providing the most comprehensive PostgreSQL solutions since 1997
> http://www.commandprompt.com/
>
> Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
> PostgreSQL Replication: http://www.commandprompt.com/products/

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 16:54:34
Message-ID: 20070205165434.GE7196@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Bruce Momjian wrote:
> > >
> > > Added to TODO:
> > >
> > > o Add \# to list command history like \s, but with line numbers
> > >
> > > http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
> >
> > Humm, this is not what we agreed.
>
> Are you saying the URL is wrong or the description?
>
> I have updated the item description to:
>
> o Add \# to list and execute command history

I guess what I am saying is that I asked you two times to add the TODO
entry that was agreed and you ignored me.

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


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 17:12:40
Message-ID: 200702051712.l15HCeI23510@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > Alvaro Herrera wrote:
> > > Bruce Momjian wrote:
> > > >
> > > > Added to TODO:
> > > >
> > > > o Add \# to list command history like \s, but with line numbers
> > > >
> > > > http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php
> > >
> > > Humm, this is not what we agreed.
> >
> > Are you saying the URL is wrong or the description?
> >
> > I have updated the item description to:
> >
> > o Add \# to list and execute command history
>
> I guess what I am saying is that I asked you two times to add the TODO
> entry that was agreed and you ignored me.

I did not ignore you --- I replied I was getting to it, and now you are
not telling me what the TODO wording should be, and now Joshua Drake
doesn't want it.

I see this email you sent me:

- Allow psql to display item numbers along each history item, depending
on a \set variable

So that is what we agreed to? OK, old item removed, and this added:

o Add a \set variable to control whether \s displays line numbers

Also, Alvaro, feel free to add TODO items yourself. There is nothing
special about me adding a TODO item except that I update the HTML, but
if I see a commit to TODO, I update TODO.html.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 17:13:49
Message-ID: 45C765CD.8030603@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


>> I am not going to be spending my time on it and I doubt anyone else will.
>
> Really, I thought there were a number of people who liked it. New text
> is:
>
> o Add \# to list and execute command history
>
> Are you sure you want it removed?
>

Well let me put it this way. I think my idea was good, I came up with it
;). There are others that felt it was good to.

On reviewing the thread, you are correct and it should probably remain a
TODO. I just won't get to it before feature freeze.

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql possible TODO
Date: 2007-02-05 17:16:42
Message-ID: 200702051716.l15HGgi08228@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Joshua D. Drake wrote:
>
> >> I am not going to be spending my time on it and I doubt anyone else will.
> >
> > Really, I thought there were a number of people who liked it. New text
> > is:
> >
> > o Add \# to list and execute command history
> >
> > Are you sure you want it removed?
> >
>
> Well let me put it this way. I think my idea was good, I came up with it
> ;). There are others that felt it was good to.
>
> On reviewing the thread, you are correct and it should probably remain a
> TODO. I just won't get to it before feature freeze.

OK, merged TODO:

o Add a \set variable to control whether \s displays line numbers

Another option is to add \# which lists line numbers, and
allows command execution.

http://archives.postgresql.org/pgsql-hackers/2006-12/msg00255.php

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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