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 1lr3yh-0007PN-Kv for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jun 2021 19:35:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lr3yf-0005uB-Ku for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Jun 2021 19:35:01 +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 1lr3yf-0005tr-DH for pgsql-hackers@lists.postgresql.org; Wed, 09 Jun 2021 19:35:01 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lr3yd-0006cG-GW for pgsql-hackers@lists.postgresql.org; Wed, 09 Jun 2021 19:35:00 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id A75AB25D0; Wed, 9 Jun 2021 15:34:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 09 Jun 2021 15:34:57 -0400 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:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=rEwtJoOfzEyQywQxhDxBgG4dSaP6uC1/eJ0qsnJUkK0=; b=hKJEe8f9 XmKFazd1gTLY15OWCGj5mw/2+k0qkAq5XUGFPdxXTJ0JUfVLaHt1/w6javHAm3xS soDqMg6gTIc5ZdDymK9YOl8bEUcrokifct9B5EsdyDNLKae5KhBHyu6LbsenVs8z j9GC9FLZ/4RAwtrcAY9/d4iS4xsxWN8zS6DPHxUDByG7LYWzZJiJEcFKko3/Wpja Lh9ySIXaU0I+LjDssbw8h/S6fdN310yFyBtgqJps+B8YyIUM0NEnhJzIIolKepST f8YeYRKXHyWo/+dyMGmniQT4bGCanz2heKceIK8W1izzbrYFMCJ8micbIxfmBegw CCCbwB95XdCRXg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduuddgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkgggtugfgjgesthekredttddtudenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepgeegveevffevjeffudethfdvtdeggefhhffguefhfeej iefgvefhfeelvedtudetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Jun 2021 15:34:56 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 72C472A0A4D; Wed, 9 Jun 2021 15:34:53 -0400 (-04) Date: Wed, 9 Jun 2021 15:34:53 -0400 From: Alvaro Herrera To: Tom Lane Cc: Yura Sokolov , pgsql-hackers@lists.postgresql.org Subject: Re: Add PortalDrop in exec_execute_message Message-ID: <202106091934.f6m5kvqizrg4@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1428037.1623265668@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jun-09, Tom Lane wrote: > I wrote: > > It turns out that the problem is specific to SELECT FOR UPDATE, and > > it happens because nodeLockRows is not careful to shut down the > > EvalPlanQual mechanism it uses before returning NULL at the end of > > a scan. If EPQ has been fired, it'll be holding a tuple slot > > referencing whatever tuple it was last asked about. The attached > > trivial patch seems to take care of the issue nicely, while adding > > little if any overhead. (A repeat call to EvalPlanQualEnd doesn't > > do much.) Thanks for researching that -- good find. > BTW, to be clear: I think Alvaro's change is also necessary. > If libpq is going to silently do something different in pipeline > mode than it does in normal mode, it should strive to minimize > the semantic difference. exec_simple_query includes a PortalDrop, > so we'd best do the same in pipeline mode. But this LockRows > misbehavior would be visible in other operating modes anyway. Agreed. I'll get it pushed after the patch I'm currently looking at. -- Álvaro Herrera 39°49'30"S 73°17'W