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 1n1pMo-0004dQ-VV for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Dec 2021 12:44:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n1pMm-0002po-Rp for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Dec 2021 12:44:40 +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 1n1pMl-0002pe-Q9 for pgsql-hackers@lists.postgresql.org; Mon, 27 Dec 2021 12:44:40 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n1pMi-0003ez-2p for pgsql-hackers@lists.postgresql.org; Mon, 27 Dec 2021 12:44:38 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 6AED53200D98; Mon, 27 Dec 2021 07:44:33 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 27 Dec 2021 07:44:33 -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=4uQtTIur/jYGiKpNo4giKlwNaJ2jGll7/QedpCVVj P0=; b=ABcp8ACkrFgh/WiC/T7/Q/5TG59saaUF+yMjlu6RXR3bj8OKErbAa0c7L X0OV6n2JBHCAIyMKbntClCGw9VhymkPBtABVyZR6+pbTjjy+u1/RnUmpnULsOqo0 3eW3DFkWlB8cXaURFHMBcQ6ziytW0j3bpo4e5EhyOWhOLv0T2a/6dPz+FisLUS6g dZvWFwJWpSPGcknresmXy8ysqxbmjnrdA+uKMrnjZG/06UDX2xXrxZqpxOBtVqFz r9UmKva/M4vNjoLI7d+C0CzV+JFz/3lvILSDDsfwndGTIMfMuCeCLZPpsUKpnbXk d46rtcOZeiD0/OW5cGkUInB+J2vwg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddruddujedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnheplefgteefiedtleelgeeg jeevhfeuteefvddtjeehveeuieefgedvhfeuleduteeunecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Dec 2021 07:44:31 -0500 (EST) Message-ID: <10906444-d995-0a34-bb22-faf6d9f07f92@enterprisedb.com> Date: Mon, 27 Dec 2021 13:44:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: psql - add SHOW_ALL_RESULTS option Content-Language: en-US To: Fabien COELHO Cc: "pgsql-hackers@lists.postgresql.org" References: <69C0B369-570C-4524-8EE4-BCCACECB6BEE@amazon.com> <20210412193301.GA11204@alvherre.pgsql> <3738387.1618451507@sss.pgh.pa.us> <451a2111-3757-c511-9413-8f8af531a167@enterprisedb.com> <18c78a01-4a34-9dd4-f78b-6860f1420c8e@enterprisedb.com> <6954328d-96f2-77f7-735f-7ce493a40949@enterprisedb.com> <2570e2ae-fa0f-aac9-f72f-bb59a9983a20@enterprisedb.com> From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 23.12.21 12:40, Fabien COELHO wrote: >> In [0], it was reported that certain replication commands result in >> infinite loops because of faulty error handling.  This still happens. >> I wrote a test for it, attached here.  (I threw in a few more basic >> tests, just to have some more coverage that was lacking, and to have a >> file to put the new test in.) > > Hmmm… For some unclear reason on errors on a PGRES_COPY_* state > PQgetResult keeps on returning an empty result. PQexec manually ignores > it, so I did the same with a comment, but for me the real bug is somehow > in PQgetResult behavior… > >> In [1], it was reported that server crashes produce duplicate error >> messages. This also still happens.  I didn't write a test for it, >> maybe you have an idea.  (Obviously, we could check whether the error >> message is literally there twice in the output, but that doesn't seem >> very general.)  But it's easy to test manually: just have psql >> connect, shut down the server, then run a query. > > This is also a feature/bug of libpq which happens to be hidden by > PQexec: when one command crashes PQgetResult actually returns *2* > results. First one with the FATAL message, second one when libpq figures > out that the connection was lost with the second message appended to the > first. PQexec just happen to silently ignore the first result. I added a > manual reset of the error message when first shown so that it is not > shown twice. It is unclear to me whether the reset should be somewhere > in libpq instead. I added a voluntary crash at the end of the psql test. I agree that these two behaviors in libpq are dubious, especially the second one. I want to spend some time analyzing this more and see if fixes in libpq might be appropriate.