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 1p84y4-0002w1-6b for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Dec 2022 19:41:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p84y2-0004LJ-JQ for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Dec 2022 19:41:30 +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 1p84y1-0004HD-HX for pgsql-hackers@lists.postgresql.org; Wed, 21 Dec 2022 19:41:30 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p84xy-0002Fs-Mp for pgsql-hackers@postgresql.org; Wed, 21 Dec 2022 19:41:28 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 57A413200413; Wed, 21 Dec 2022 14:41:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 21 Dec 2022 14:41:24 -0500 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=fm2; t=1671651683; x=1671738083; bh=E IicKdY6AOi7v+DpTFiEn2Sg3TVhnivhqUZifptPiTw=; b=d3Y4FssZNFPvKbAKV l2h7+rZEI1ju2bmvg7A9gJuMq7UuhRm2LB4TKTg6FKY1ZvM2nv8amh1DbvqJ/Bnu uYo16hnBJsumjmLsNqeyp6VcqK6dTbUaQ82NkWj6flubLY4XabTmnCoJn8/HYDds TCi8od48djZg7CIA0y3FUlrJoAvzvG1hDChyQZchV6UVFHRF8DBiPXYfohBlT3Me LeSxt/0vGm4+rlqjynUDLhyHS1PKfg7GyHjZkawwI/4IIq4zbnJtaSyxnT5VXcWI yIU++GVnvuFNfwv12ggYYcyn6jYkF3uJ9K+q6bKPjEvNAyEyddcw0xhHyOoOZeZd yju4w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeekgdduvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 21 Dec 2022 14:41:23 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 55AC6E9A; Wed, 21 Dec 2022 20:41:20 +0100 (CET) Date: Wed, 21 Dec 2022 20:41:20 +0100 From: Alvaro Herrera To: Peter Eisentraut Cc: pgsql-hackers Subject: Re: dynamic result sets support in extended query protocol Message-ID: <20221221194120.wttku6u7cbd6e574@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-Nov-22, Peter Eisentraut wrote: > I added tests using the new psql \bind command to test this functionality in > the extended query protocol, which showed that this got broken since I first > wrote this patch. This "blame" is on the pipeline mode in libpq patch > (acb7e4eb6b1c614c68a62fb3a6a5bba1af0a2659). I need to spend more time on > this and figure out how to repair it. In the meantime, here is an updated > patch set with the current status. I looked at this a little bit to understand why it fails with \bind. As you say, it does interact badly with pipeline mode -- more precisely, it collides with the queue handling that was added for pipeline. The problem is that in extended query mode, we "advance" the queue in PQgetResult when asyncStatus is READY -- fe-exec.c line 2110 ff. But the protocol relies on returning READY when the second RowDescriptor message is received (fe-protocol3.c line 319), so libpq gets confused and everything blows up. libpq needs the queue to stay put until all the results from that query have been consumed. If you comment out the pqCommandQueueAdvance() in fe-exec.c line 2124, your example works correctly and no longer throws a libpq error (but of course, other things break). I suppose that in order for this to work, we would have to find another way to "advance" the queue that doesn't rely on the status being PGASYNC_READY. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/