Re: BUG #16034: `\set ECHO all` doesn't work for \e command - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16034: `\set ECHO all` doesn't work for \e command
Date
Msg-id 10221.1570035107@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #16034: `\set ECHO all` doesn't work for \e command  (Pavlo Golub <pavlo.golub@cybertec.at>)
List pgsql-bugs
Pavlo Golub <pavlo.golub@cybertec.at> writes:
> On Wed, Oct 2, 2019 at 5:56 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Uh, what?  \e doesn't send anything to the server, it just edits
>> the query buffer locally.

> According to the manual:
> The new contents of the query buffer are then re-parsed according to
> the normal rules of psql, treating the whole buffer as a single line.
> Any complete queries are immediately executed (sic!); that is, if the
> query buffer contains or ends with a semicolon, everything up to that
> point is executed.

Ah.  So there are really two separate issues here:

1.  If there's complete query(s), they aren't echoed to the terminal
before execution.  Probably we could just echo them and be done
(though I wonder if this ought to depend on interactiveness).  I'm
not hugely excited about that, but it's reasonable.

2.  If there's a partial query, it's stuffed back into the query
buffer but you don't see it.  This is definitely bad, and IIRC it's
been complained of before, unlike point 1.  The problem is that
there's no portable way (AFAIK) of getting libreadline/libedit to
echo the partial query.  If you know of a way, please send a patch.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16033: segmentation fault when runing update
Next
From: "Daniel Verite"
Date:
Subject: Re: BUG #16034: `\set ECHO all` doesn't work for \e command