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 1n9rTu-00028j-C3 for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jan 2022 16:37:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n9rTs-0002TI-91 for pgsql-hackers@arkaria.postgresql.org; Tue, 18 Jan 2022 16:37:12 +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 1n9rTr-0002Sj-V8 for pgsql-hackers@lists.postgresql.org; Tue, 18 Jan 2022 16:37:11 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9rTk-0003nr-9U for pgsql-hackers@lists.postgresql.org; Tue, 18 Jan 2022 16:37:10 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A29415C03A3; Tue, 18 Jan 2022 11:37:02 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 18 Jan 2022 11:37:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=LPeHXjj3gR9Q0DA3Aha4yecVnZFrCUJbB31MC8aoF eU=; b=mBDG+SQNxkj9+fNzJXTBRvrUzeby4O3H8yjUdXBPnD+p3Gi2LX1oSOdc0 y7S9nB3Gw26v0zCCG3dfeFpRXcHXGnM237sycIjDn6fRRStmBoj0biuzj/eGRsc8 o0MEFCDFKsRdaQdhIXBqgvQDmljQxunxiM12VN4C8qq+zyZVShfyTtlAHYl5XsuT N8m2dnndO7HgOJ47Ehfuh8apAAgl38nSZZRhGDLQudRi32Q47/9go/LFUe/YIs3P 19Z/iRDy69RbAjLuVpTVZAZ5DRj8Dp05Te0/Aa0p6md30zOx9zQry9EM75HbwW7I Ea6wCQD6XLhkdz34IUseegzsinNeg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudefgdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvghtvghr ucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnthgvrh hprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeefjeegheetuefhveevudel ueeftdejteeiffetvdduhfdtieefgfeutedtveeggfenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthes vghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Jan 2022 11:37:00 -0500 (EST) Message-ID: <47bcee2e-3e4c-a0ea-daee-9b3e2d65df05@enterprisedb.com> Date: Tue, 18 Jan 2022 17:36:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: psql - add SHOW_ALL_RESULTS option Content-Language: en-US To: Fabien COELHO Cc: "pgsql-hackers@lists.postgresql.org" References: <18c78a01-4a34-9dd4-f78b-6860f1420c8e@enterprisedb.com> <6954328d-96f2-77f7-735f-7ce493a40949@enterprisedb.com> <2570e2ae-fa0f-aac9-f72f-bb59a9983a20@enterprisedb.com> <46259d13-5f90-1475-3c85-d7a597a2b862@enterprisedb.com> <20220113054433.wdjhidtm7gvyhfts@alap3.anarazel.de> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 15.01.22 10:00, Fabien COELHO wrote: >> The reason this test constantly fails on cfbot windows is a >> use-after-free >> bug. > > Indeed! Thanks a lot for the catch and the debug! > > The ClearOrSaveResult function is quite annoying because it may or may > not clear the result as a side effect. > > Attached v14 moves the status extraction before the possible clear. I've > added a couple of results = NULL after such calls in the code. In the psql.sql test file, the test I previously added concluded with \set ECHO none, which was a mistake that I have now fixed. As a result, the tests that you added after that point didn't show their input lines, which was weird and not intentional. So the tests will now show a different output. I notice that this patch has recently gained a new libpq function. I gather that this is to work around the misbehaviors in libpq that we have discussed. But I think if we are adding a libpq API function to work around a misbehavior in libpq, we might as well fix the misbehavior in libpq to begin with. Adding a new public libpq function is a significant step, needs documentation, etc. It would be better to do without. Also, it makes one wonder how others are supposed to use this multiple-results API properly, if even psql can't do it without extending libpq. Needs more thought.