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 1hFPPM-0005jH-5A for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Apr 2019 20:37:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hFPPJ-00015Q-O3 for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Apr 2019 20:37:49 +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 1hFPPJ-0000o7-A5 for pgsql-hackers@lists.postgresql.org; Sat, 13 Apr 2019 20:37:49 +0000 Received: from courriel.mines-paristech.fr ([77.158.173.149] helo=antispam-1.ensmp.fr) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFPPG-0006hz-6w for pgsql-hackers@lists.postgresql.org; Sat, 13 Apr 2019 20:37:48 +0000 Received: from smtp-4.mines-paristech.fr (smtp-4.ensmp.fr [77.158.173.143]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by antispam-1.ensmp.fr (antispam.mines-paristech.fr) with ESMTPS id 9AFFF55E88 for ; Sat, 13 Apr 2019 22:37:44 +0200 (CEST) Received: from lancre (unknown [151.49.109.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-4.mines-paristech.fr (Postfix) with ESMTPSA id 2E2952C023E for ; Sat, 13 Apr 2019 22:37:44 +0200 (CEST) Date: Sat, 13 Apr 2019 22:37:37 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@lancre Reply-To: Fabien COELHO To: PostgreSQL Developers Subject: psql - add SHOW_ALL_RESULTS option Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-869336793-1555187864=:8961" X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: 0 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrvdehgdduheduucetufdoteggodetrfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhrhfvuffkfgggtgesmhdtreertdervdenucfhrhhomhephfgrsghivghnucevqffgnffjqfcuoegtohgvlhhhohestghrihdrvghnshhmphdrfhhrqeenucfkphepudehuddrgeelrddutdelrddvtdeinecurfgrrhgrmhepmhhouggvpehsmhhtphhouhht X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-869336793-1555187864=:8961 Content-Type: text/plain; format=flowed; charset=US-ASCII Hello devs, The attached patch implements a new SHOW_ALL_RESULTS option for psql, which shows all results of a combined query (\;) instead of only the last one. This solves a frustration that intermediate results were hidden from view for no good reason that I could think of. For that, call PQsendQuery instead of (mostly not documented) PQexec, and rework how results are processed afterwards. Timing is moved to ProcessQueryResults to keep the last result handling out of the measured time. I think it would not be a big deal to include it, but this is the previous behavior. In passing, refactor a little and add comments. Make function names about results plural or singular consistently with the fact the it processes one or several results. Change "PrintQueryResult" to "HandleQueryResult" because it was not always printing something. Also add a HandleCopyResult function, which makes the patch a little bigger by moving things around but clarifies the code. Code in "common.c" is actually a little shorter than the previous version.