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 1iFhqz-0002os-SG for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Oct 2019 16:51:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iFhqy-0007Pt-L8 for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Oct 2019 16:51:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iFhqy-0007Pi-DW for pgsql-bugs@lists.postgresql.org; Wed, 02 Oct 2019 16:51:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iFhqw-0002TF-7N for pgsql-bugs@lists.postgresql.org; Wed, 02 Oct 2019 16:51:52 +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 x92GplYj010222; Wed, 2 Oct 2019 12:51:47 -0400 From: Tom Lane To: Pavlo Golub cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16034: `\set ECHO all` doesn't work for \e command In-reply-to: References: <16034-a7ebf0622970a1dd@postgresql.org> <7946.1570031807@sss.pgh.pa.us> Comments: In-reply-to Pavlo Golub message dated "Wed, 02 Oct 2019 18:11:39 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10220.1570035107.1@sss.pgh.pa.us> Date: Wed, 02 Oct 2019 12:51:47 -0400 Message-ID: <10221.1570035107@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pavlo Golub writes: > On Wed, Oct 2, 2019 at 5:56 PM Tom Lane 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