Thread: psql possible TODO

psql possible TODO

From
"Joshua D. Drake"
Date:
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=> !@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





Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.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=> !@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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
> > 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





Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.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


Re: psql possible TODO

From
Bruce Momjian
Date:
Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
"Jim C. Nasby"
Date:
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@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)


Re: psql possible TODO

From
Alvaro Herrera
Date:
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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
> 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





Re: psql possible TODO

From
Stephen Harris
Date:
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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
> > > 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@compile.commandprompt.com:pgdump* . 795  scp admin@compile.commandprompt.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.sh806  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





Re: psql possible TODO

From
"Joshua D. Drake"
Date:
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





Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.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


Re: psql possible TODO

From
Bruce Momjian
Date:
Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
Tom Lane
Date:
Stephen Harris <lists@spuddy.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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 17:30 -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.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





Re: psql possible TODO

From
"Joshua D. Drake"
Date:
> > 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





Re: psql possible TODO

From
Alvaro Herrera
Date:
Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.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


Re: psql possible TODO

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> Tom Lane wrote:
> > "Joshua D. Drake" <jd@commandprompt.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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 17:34 -0500, Tom Lane wrote:
> Stephen Harris <lists@spuddy.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





Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 17:45 -0500, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Tom Lane wrote:
> > > "Joshua D. Drake" <jd@commandprompt.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





Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 17:56 -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.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





Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
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@commandprompt.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





Re: psql possible TODO

From
Jeremy Drake
Date:
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


Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.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


Re: psql possible TODO

From
Bruce Momjian
Date:
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@commandprompt.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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
David Fetter
Date:
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@commandprompt.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@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


Re: psql possible TODO

From
Richard Troy
Date:
On Tue, 5 Dec 2006, Tom Lane wrote:
>
> "Joshua D. Drake" <jd@commandprompt.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@ScienceTools.com, http://ScienceTools.com/



Re: psql possible TODO

From
"Joshua D. Drake"
Date:
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@commandprompt.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





Re: psql possible TODO

From
Tom Lane
Date:
Richard Troy <rtroy@ScienceTools.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


Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
On Tue, Dec 05, 2006 at 05:30:03PM -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
"Joshua D. Drake"
Date:
> 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





Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 19:12 -0500, mark@mark.mielke.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





Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
"Joshua D. Drake"
Date:
> 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





Re: psql possible TODO

From
"Joshua D. Drake"
Date:
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





Re: psql possible TODO

From
Richard Troy
Date:
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@ScienceTools.com, http://ScienceTools.com/



Re: psql possible TODO

From
"Joshua D. Drake"
Date:
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





Re: psql possible TODO

From
Svenne Krap
Date:
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

Re: psql possible TODO

From
Jeff Davis
Date:
On Tue, 2006-12-05 at 19:09 -0500, mark@mark.mielke.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



Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 21:03 -0500, mark@mark.mielke.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





Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
On Tue, Dec 05, 2006 at 06:08:37PM -0800, Joshua D. Drake wrote:
> On Tue, 2006-12-05 at 21:03 -0500, mark@mark.mielke.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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
Mark Kirkwood
Date:
mark@mark.mielke.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


Re: psql possible TODO

From
Tom Lane
Date:
"Joshua D. Drake" <jd@commandprompt.com> writes:
> On Tue, 2006-12-05 at 19:12 -0500, mark@mark.mielke.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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Tue, 2006-12-05 at 22:25 -0500, Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.com> writes:
> > On Tue, 2006-12-05 at 19:12 -0500, mark@mark.mielke.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





Re: psql possible TODO

From
Stephen Harris
Date:
On Tue, Dec 05, 2006 at 05:34:58PM -0500, Tom Lane wrote:
> Stephen Harris <lists@spuddy.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


Re: psql possible TODO

From
Stephen Harris
Date:
On Tue, Dec 05, 2006 at 09:03:18PM -0500, mark@mark.mielke.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


Re: psql possible TODO

From
Tom Lane
Date:
Stephen Harris <lists@spuddy.org> writes:
> On Tue, Dec 05, 2006 at 05:34:58PM -0500, Tom Lane wrote:
>> Stephen Harris <lists@spuddy.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


Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
On Wed, Dec 06, 2006 at 03:56:35PM +1300, Mark Kirkwood wrote:
> mark@mark.mielke.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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
mark@mark.mielke.cc
Date:
On Tue, Dec 05, 2006 at 11:46:52PM -0500, Stephen Harris wrote:
> On Tue, Dec 05, 2006 at 09:03:18PM -0500, mark@mark.mielke.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@mielke.cc / markm@ncf.ca / markm@nortel.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
bindthem...
 
                          http://mark.mielke.cc/



Re: psql possible TODO

From
"Andrew Dunstan"
Date:
Stephen Harris wrote:
> On Tue, Dec 05, 2006 at 09:03:18PM -0500, mark@mark.mielke.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



Re: psql possible TODO

From
Alvaro Herrera
Date:
Tom Lane wrote:
> Richard Troy <rtroy@ScienceTools.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


Re: psql possible TODO

From
Bruce Momjian
Date:
Alvaro Herrera wrote:
> Tom Lane wrote:
> > Richard Troy <rtroy@ScienceTools.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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
On Fri, 2006-12-29 at 20:59 -0500, Bruce Momjian wrote:
> Alvaro Herrera wrote:
> > Tom Lane wrote:
> > > Richard Troy <rtroy@ScienceTools.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





Re: psql possible TODO

From
Alvaro Herrera
Date:
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@ScienceTools.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.


Re: psql possible TODO

From
Bruce Momjian
Date:
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@ScienceTools.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@postgresql.org so that your
>        message can get through to the mailing list cleanly

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
Bruce Momjian
Date:
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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
Bruce Momjian
Date:
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@postgresql.org so that your
>        message can get through to the mailing list cleanly

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
Alvaro Herrera
Date:
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


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
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/



Re: psql possible TODO

From
Bruce Momjian
Date:
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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
Bruce Momjian
Date:
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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
Alvaro Herrera
Date:
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


Re: psql possible TODO

From
Bruce Momjian
Date:
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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: psql possible TODO

From
"Joshua D. Drake"
Date:
>> 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/



Re: psql possible TODO

From
Bruce Momjian
Date:
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@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +