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

From: Pavlo Golub <pavlo(dot)golub(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:11:39
Message-ID: CAK7ymcLvRGwjHXdvQX7eJVLS3SigmuvAxLWex+xz3ciEJqizqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Oct 2, 2019 at 5:56 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > I want command sent to the server with \e command to be echoed to the
> > terminal.
>
> 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.

My terminal looks like this:

timetable=# \e
version
--------------------------------------------------------------------------------------------------------
PostgreSQL 11.2 on x86_64-pc-mingw64, compiled by gcc.exe (Rev5,
Built by MSYS2 project) 4.9.2, 64-bit
(1 row)

As you can see, you have no idea what the query was executed.
And sometimes you really want to know that, especially trying to analyze
query were executed during a session.
Agree, probably ECHO is not the best solution since it's intended not
for interactive mode.
ECHO_HIDDEN seems to be the correct approach.

>
> I could interpret your request as being that ECHO_HIDDEN causes "hidden"
> commands to be shoved into the command history (whence they could be
> recalled and edited) as well as being echoed. While I can see some
> use-case for that, I think it'd more usually be an annoyance and/or break
> cases that work today. If we decide that's a useful feature, I'd vote
> for leaving ECHO_HIDDEN alone and inventing a separate variable to enable
> it (HISTORY_HIDDEN, or some such?).
>
> regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

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