Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljNPI-0005rF-1L for pgsql-bugs@arkaria.postgresql.org; Wed, 19 May 2021 14:42:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ljNPG-0005cO-Vc for pgsql-bugs@arkaria.postgresql.org; Wed, 19 May 2021 14:42:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljNPG-0005c7-P4 for pgsql-bugs@lists.postgresql.org; Wed, 19 May 2021 14:42:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljNPE-0008HX-M3 for pgsql-bugs@lists.postgresql.org; Wed, 19 May 2021 14:42:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 14JEgd6e3429978; Wed, 19 May 2021 10:42:39 -0400 From: Tom Lane To: francois.grandvarlet@wanadoo.fr cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17020: meta command psql \reset does not clear the query buffer In-reply-to: <17020-f5e23166506e7932@postgresql.org> References: <17020-f5e23166506e7932@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 18 May 2021 22:16:16 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3429976.1621435359.1@sss.pgh.pa.us> Date: Wed, 19 May 2021 10:42:39 -0400 Message-ID: <3429977.1621435359@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > issuing a command like : SELECT * FROM generate_series (1, 1000); > meta command \p shows the query buffer > meta command \reset tells "Query buffer reset (cleared)." > but meta command \p still shows the query buffer and meta command \g execute > the query > Is this the normal behavior ? Yes. \p is documented as Print the current query buffer to the standard output. If the current query buffer is empty, the most recently executed query is printed instead. and \g likewise says "If the current query buffer is empty, the most recently sent query is re-executed instead". > It seems to me that the query buffer should be empty after issuing \reset It is. If you now type something, that something is a new command that's not concatenated with what you typed before. regards, tom lane