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

From Pavlo Golub
Subject Re: BUG #16034: `\set ECHO all` doesn't work for \e command
Date
Msg-id CAK7ymcLvRGwjHXdvQX7eJVLS3SigmuvAxLWex+xz3ciEJqizqQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16034: `\set ECHO all` doesn't work for \e command  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #16034: `\set ECHO all` doesn't work for \e command
Re: BUG #16034: `\set ECHO all` doesn't work for \e command
List pgsql-bugs
On Wed, Oct 2, 2019 at 5:56 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

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