psql: recall previous command?

Поиск
Список
Период
Сортировка
От Neil Conway
Тема psql: recall previous command?
Дата
Msg-id 421AB48C.4010604@samurai.com
обсуждение исходный текст
Ответы Re: psql: recall previous command?  (lsunley@mb.sympatico.ca)
Re: psql: recall previous command?  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Re: psql: recall previous command?  (Ian Barwick <barwick@gmail.com>)
Re: psql: recall previous command?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: psql: recall previous command?  (Darcy Buskermolen <darcy@wavefire.com>)
Re: psql: recall previous command?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: psql: recall previous command?  (Thomas F.O'Connell <tfo@sitening.com>)
Список pgsql-hackers
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.

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: left-deep plans?
Следующее
От: lsunley@mb.sympatico.ca
Дата:
Сообщение: Re: psql: recall previous command?