Re: BUG #16034: `\set ECHO all` doesn't work for \e command

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavlo Golub <pavlo(dot)golub(at)cybertec(dot)at>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16034: `\set ECHO all` doesn't work for \e command
Date: 2019-10-02 16:51:47
Message-ID: 10221.1570035107@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pavlo Golub <pavlo(dot)golub(at)cybertec(dot)at> writes:
> On Wed, Oct 2, 2019 at 5:56 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniel Verite 2019-10-02 17:47:49 Re: BUG #16034: `\set ECHO all` doesn't work for \e command
Previous Message Tom Lane 2019-10-02 16:15:04 Re: BUG #16033: segmentation fault when runing update