Re: TODO item -- Improve psql's handling of multi-line queries

Поиск
Список
Период
Сортировка
От Andreas Seltenreich
Тема Re: TODO item -- Improve psql's handling of multi-line queries
Дата
Msg-id 87hd9kheof.fsf@gate450.dyndns.org
обсуждение исходный текст
Ответ на Re: TODO item -- Improve psql's handling of multi-line  ("Sergey E. Koposov" <math@sai.msu.ru>)
Ответы Re: TODO item -- Improve psql's handling of multi-line  ("Sergey E. Koposov" <math@sai.msu.ru>)
Список pgsql-patches
Sergey E. Koposov schrob:

> I submit the new version of my patch (against the CVS tip), correcting the
> problem with \edit (pointed by Andreas). So now everything works fine.

I think there's a pgflush_history() call missing somewhere, since the
buffer isn't flushed on a control-c. The fresh query is appended to
the aborted one in the history:

--8<---------------cut here---------------start------------->8---
nnpg=# select
nnpg-#   something_i_would_rather_not_submit_yet
nnpg-# -- <control-c>
nnpg=# select 1;
 ?column?
----------
        1
(1 row)

nnpg=# -- <control-p> will now yield the following history entry
nnpg=# select
  something_i_would_rather_not_submit_yet
select 1;
--8<---------------cut here---------------end--------------->8---

Some more comments:

Wouldn't it be more elegant to use the facilities in libpq's
pqexpbuffer.h for the history buffer instead of passing the
buffer-length around as a separate function argument and doing custom
string operations?

The multi-line history entries are not preserved between psql
invocations. Bash does solve this by folding multi-line commands into
a single line where possible. But I have to admit, this could be sold
as another TODO item :-)

regards,
Andreas

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Skipping VACUUM of indexes when no work required
Следующее
От: Nicolas Barbier
Дата:
Сообщение: Re: Patch to allow contrib/pgbench files to have blank lines