Re: psql: recall previous command?

From: Darcy Buskermolen <darcy(at)wavefire(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: recall previous command?
Date: 2005-02-22 16:57:30
Message-ID: 200502220857.30131.darcy@wavefire.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On February 21, 2005 08:26 pm, Neil Conway wrote:
> Is there a way to recall the previous command in psql? Obviously, "up
> arrow" or Ctrl-P using readline and the default readline bindings is
> close, but it recalls the previous _line_ of input. That is not at all
> the same thing in the case of a multiple line command, for example.

Currently I use \e to bring up the last command (multiline) in the editor,
from this point I can just save it to execute it.

>
> If there is no way at present, I think there should be. Using "up arrow"
> is quite annoying when dealing with multiple line SQL statements.
>
> Two issues:
>
> - how to handle slash commands? Slash commands and SQL statements can be
> intermixed:
>
> neilc=# select 1 \timing
> Timing is off.
> neilc-# ;
> ?column?
> ----------
> 1
> (1 row)
>
> So I'm not quite sure what the right behavior here is. We could always
> just ignore slash commands (the command would "recall the previous SQL
> statement") -- since few slash commands are multi-line, I don't think
> that would be too bad.
>
> - when a multiple-line command is recalled, how should it be presented
> in the psql input buffer? Perhaps we could strip newlines from recalled
> command text, so that the recalled command would fit on a single line.
> That would mean the recalled command would look somewhat different than
> how the user typed it, although of course the semantics of the query
> should be the same. Any better ideas?
>
> -Neil
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--
Darcy Buskermolen
Wavefire Technologies Corp.
ph: 250.717.0200
fx: 250.763.1759
http://www.wavefire.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2005-02-22 17:54:38 Re: Get rid of system attributes in pg_attribute?
Previous Message Tom Lane 2005-02-22 16:24:31 Re: Get rid of system attributes in pg_attribute?