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 1ojOaZ-0007EX-QR for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Oct 2022 17:35:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ojOaY-00024H-AV for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Oct 2022 17:35:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojOaX-000248-5v for pgsql-hackers@lists.postgresql.org; Fri, 14 Oct 2022 17:35:14 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ojOaT-0007MJ-7g for pgsql-hackers@lists.postgresql.org; Fri, 14 Oct 2022 17:35:12 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id CA4DC32007BE; Fri, 14 Oct 2022 13:35:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 14 Oct 2022 13:35:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1665768903; x=1665855303; bh=4 lPJj/6OPgyEmNWCczeueBwqd3ZvFRAO8ISOPkeN7Pw=; b=hPsnygnBpyulYcjbP W7EV1C6kkV1JrhoXa1OV/rCBcRD+jG7ZfpzvcYl1x0M3Zo8v6PMH3SXLLeRspyan wZYVZ4ZgI/zLVqhzSbYaxw53yE9eEzIPfUPqh0HSxllaRlxc3meLzL+N4jjP1sg/ 0jI909XiRwBI9N1euTc5ARbWoioOWWutY1Bd2f6LGFwc1Y6Abh/N7BX8xcbKHW3l RskqOGMbpt6GsmRvanji2eBWhLAFzmcznOIN2/njn9ZDXOFKbHBuPPaItDquDg6M XtwyRiOksJBxZKIgBrSnbWfu7KUfStp9nuisGEqWt+anLfyg0HqCbM4vwGBJa8lC mZE1g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeekvddgudduhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 14 Oct 2022 13:35:02 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D5DA468; Fri, 14 Oct 2022 19:34:58 +0200 (CEST) Date: Fri, 14 Oct 2022 19:34:58 +0200 From: Alvaro Herrera To: Denis Laxalde Cc: pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] Reset single-row processing mode at end of pipeline commands queue Message-ID: <20221014173458.iacteadybkaja5sy@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <01af18c5-dacc-a8c8-07ee-aecc7650c3e8@dalibo.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Denis, On 2022-Oct-07, Denis Laxalde wrote: > I'm trying to make single-row mode and pipeline mode work together in > Psycopg using libpq. I think there is something wrong with respect to the > single-row mode flag, not being correctly reset, in some situations. > > The minimal case I'm considering is (in a pipeline): > * send query 1, > * get its results in single-row mode, > * send query 2, > * get its results *not* in single-row mode. > > It seems that, as the command queue in the pipeline is empty after getting > the results of query 1, the single-row mode flag is not reset and is still > active for query 2, thus leading to an unexpected PGRES_SINGLE_TUPLE status. > > The attached patch demonstrates this in the test suite. It also suggests to > move the statement resetting single-row mode up in pqPipelineProcessQueue(), > before exiting the function when the command queue is empty in particular. Your suggestion to move the code up seems correct to me. Therefore, I have pushed this including the added test code. Thanks for an excellent report and patch. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/