Re: TODO item -- Improve psql's handling of multi-line queries - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: TODO item -- Improve psql's handling of multi-line queries
Date
Msg-id 200512080237.jB82bDX04978@candle.pha.pa.us
Whole thread Raw
In response to Re: TODO item -- Improve psql's handling of multi-line  ("Sergey E. Koposov" <math@sai.msu.ru>)
List pgsql-patches
[ Previous version removed.]

Your patch has been added to the PostgreSQL unapplied patches list at:

    http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Sergey E. Koposov wrote:
> On Wed, 7 Dec 2005, Andreas Seltenreich wrote:
>
> > 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:
>
> > 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?
>
>
> Thank you, Andreas. I corrected the bug and also switched to pqexpbuffer
> instead of my own work with the strings.
>
> The new patch is attached.
>
> >
> > 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 :-)
> >
>
> I also wanted this feature for a long time.
> And I agree that it is rather simple to just remove the \n when writing to the
> readline history file, but I don't think that's what everybody wants. I
> think that people want to preserve the original formatting...
>
> So in that case the solution can be just putting some symbol instead of \n
> in the history file, and during the loading of that file replace it back
> (that symbol can be zero byte for example). But I'm not sure that people
> will like that solution too.
>
>
> Regards,
>     Sergey
>
> *****************************************************
> Sergey E. Koposov
> Max-Planck Institut for Astronomy
> Web: http://lnfm1.sai.msu.ru/~math
> E-mail: math@sai.msu.ru

Content-Description:

[ Attachment, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

pgsql-patches by date:

Previous
From: "Sergey E. Koposov"
Date:
Subject: Re: TODO item -- Improve psql's handling of multi-line
Next
From: Andrew Dunstan
Date:
Subject: Re: TODO item -- Improve psql's handling of multi-line