Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iG7Ge-0008H3-RC for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Oct 2019 20:00:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iG7Gd-0004Nh-7R for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Oct 2019 20:00:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iG7Gc-0004NU-ST for pgsql-bugs@lists.postgresql.org; Thu, 03 Oct 2019 20:00:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iG7Ga-0001Rl-GG for pgsql-bugs@lists.postgresql.org; Thu, 03 Oct 2019 20:00:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x93JxvDC028671; Thu, 3 Oct 2019 15:59:57 -0400 From: Tom Lane To: "Daniel Verite" cc: "Pavlo Golub" , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16034: `\set ECHO all` doesn't work for \e command In-reply-to: <1c0128a5-0507-4e53-902e-f1a4596b267e@manitou-mail.org> References: <1c0128a5-0507-4e53-902e-f1a4596b267e@manitou-mail.org> Comments: In-reply-to "Daniel Verite" message dated "Thu, 03 Oct 2019 19:46:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28669.1570132797.1@sss.pgh.pa.us> Date: Thu, 03 Oct 2019 15:59:57 -0400 Message-ID: <28670.1570132797@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Daniel Verite" 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