Re: psql and readline

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql and readline
Date: 2003-01-09 22:46:20
Message-ID: 20030109224620.GB30740@wallace.ece.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 09, 2003 at 10:49:33PM +0100, Peter Eisentraut wrote:
> Christopher Kings-Lynne writes:
>
> > Is there any way of making the 'up' arrow retrieve all of the last multiline
> > query, instead of just the last line?
>
> There is nothing technical that should prevent you from implementing it.
> But you need to come up with a reasonable system to keep the history
> straight if meta commands are mixed with multiline commands, such as
>
> select *
> \x
> from foo;

Peter, what do you think about pushing the query buffer onto the history
stack at execution time, any time it's a multiline query? That way,
after the above sequence, you'd have:

(1) select *
(2) \x
(3) from foo;
(4) select *
from foo;

Yeah, this wastes a history slot, but it does solve the problem. It's also
dead simple to code. ;-)

BTW, the behavior in bash for multiline interactive entered commands
is to concatenate them into a single line and dump them in the history,
replacing the individual parts. The individual parts are in the history
while you're at the secondary prompt, then go away after execution. In
psql, we'd probably just lose interstitial metacommands.

Ross

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2003-01-09 22:49:55 Re: Dollar in identifiers
Previous Message Dann Corbit 2003-01-09 22:31:32 Re: Dollar in identifiers