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: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
Cc: "Pavlo Golub" <pavlo(dot)golub(at)cybertec(dot)at>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16034: `\set ECHO all` doesn't work for \e command
Date: 2019-10-03 19:59:57
Message-ID: 28670.1570132797@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Daniel Verite" <daniel(at)manitou-mail(dot)org> writes:
>> Pavlo Golub wrote:
>>> \set ECHO queries
>>> would display them including immediately after \e in an interactive
>>> session.

>> Oh, great! That works! Thanks! But why ECHO all doesn't? Should all
>> include queries by default?

> As I understand, "ECHO all" does nothing when the commands are
> read interactively. So in that mode it's the same as "ECHO none",
> and it doesn't seem very useful indeed.
> It appears to be an ancient decision, since it was already
> described in the 7.1 docs pretty much like it is today:
> https://www.postgresql.org/docs/7.1/app-psql.html

The reason why it doesn't echo commands in interactive mode is that
you presumably just typed the command (and had it echoed back at you,
by the tty driver if not readline), so echoing it again would be
duplicative and annoying. I don't think we should add such annoyance
in normal cases as a band-aid for the problem with \e.

BTW, "ECHO all" and "ECHO queries" are totally different; the one
is not a superset of the other. "all" prints lines as they are read,
the other prints commands when they are sent to the server. One reason
why you don't want "ECHO all" to be active in interactive mode is that
it'd make a complete hash of things while typing a multiline query.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2019-10-03 21:05:21 Re: Write skew anmalies are found in SERIALIZABLE isolation
Previous Message Daniel Verite 2019-10-03 17:46:44 Re: BUG #16034: `\set ECHO all` doesn't work for \e command