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

From: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
To: "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: TODO item -- Improve psql's handling of multi-line queries
Date: 2005-12-07 19:48:00
Message-ID: 87hd9kheof.fsf@gate450.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Kaitlin Bledsoe 2005-12-07 20:03:06 Save money! zlwuanej
Previous Message Bruce Momjian 2005-12-07 17:46:22 Foreign key trigger timing bug?