Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x45nA-006tyU-05 for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2026 00:03:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x45n9-00AefF-0B for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Sep 2026 00:03:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x45n8-00Aef7-1F for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2026 00:03:54 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x45n6-00000004gEP-2aMG for pgsql-hackers@lists.postgresql.org; Wed, 09 Sep 2026 00:03:53 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 450E91400032; Tue, 8 Sep 2026 20:03:51 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Tue, 08 Sep 2026 20:03:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1788912231; x=1788998631; bh=MzJkM8SLsW 5oLN3AJONHOFxC26PxWqaqUgzRyOhJ6pA=; b=KeBex4+Vn2PSSmfZnJ8p3Z+eD5 1+3O43KXL1kglus/SRcAqZsT14tec9Zw4fqnH4yqqwS57MXnrCHrPo6+OodpYrYY N6HKwtMc4FlQgDhFf6ni/M/YqXb6rDUr0CnO4jx23fi817QkSzcjLQcJnFfHY7QX YqE0V8wEB/jWpEk8kPU46i4qDdxoQiaFrMT/OXwYj1i/VjwoZfAn8ztDEmapjmwn ifwj6jTr/9nodAXUTVfjT6XOStY6ar1dCwogGLJ2LlLAa9HViuTOWd86UR1wuKdz cD6OVgenvzhBXjtgJ9K+rIULc6f/pZCiZL8teOnUDj1euDRthzwbqyuuycrg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1788912231; x=1788998631; bh=MzJkM8SLsW5oLN3AJONHOFxC26PxWqaqUgz RyOhJ6pA=; b=IYpkTQVqUJhazomBz+pApW3C29W3+nweYicTt+ALQXbD46dXFsP w6j84xUXnX/Hxj2X79PFObO6qrKbfbAIXutubmvwxVmJL1ciGNjgr2ATIc82jf9A GFRATWObTBItCbIh7tNTVYgxk3viCCPayJ/zCJPXkJgYRZklxIEMC7ob0q47XFtQ 72VvqT07at0zn0CM+hLjVoQtI/GTy7Mr/HmjM3eDykh4tYJ1PlhzWWSDh1nlmey3 ti3v927z0zZPqpPqkCx14wRO2LlBh0A+G8V3RXSE19qTfZtAmK8pLoK/5G4EOKWb wlDMKKAAldS22kA95z8gHjiMTQ7CsYk/0Aw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTE3un4VZFFaBqM7B/dy2BFLxVKDXaNPm4PpdvpC0FGQ4V6rUBGJGLUvW6E2n+deQS 4Eh0pQuBX0Ar8VWqI+0b3pAf7voWQkIQX0jVR/4z0J2NpazrMwSa4B8XjwkcHKTunH3PAF aPCAhjL68T11YY5aht896sXlLIWjRv8YM+qeh9+lmaG/INT+NliYcctZlldseFa2Zy+Wfa snkylxb0F5dm4tTFCqfJqdzxmDhvUnZb5TIFJsKG+SsQAqpUiPuecRZswSE1jpKAFK1Lof t0LH/hX7c5dJt1501XxUtL4qfLKdp1Gc4ss8cJkistjqmuf2VzTsa5dZaCEHsl1FnoNHcQ Nnd6F/17gxM6moYi4i2yH0yx/t3Kskc76oAeF7CEmaJDsgK64bUesHP6PbrJDttzSzmShP EY8K1FLX2/ROYHjljkzi+hZH8camvXKr679RmQntATMrvI6ehOSLkqHX7Go91i9RX83hZB ZmNKfO8D1JfgPNQ/vSWfXv2B274FKZ/ewBSRV16ivV9X1yhCyc+QqZcT7ZjAh4KbW8ZEO4 uxKcrgQoW8GMNLGcFQvLvA8bETh2sR+SObUBGjcn7aLOIru2UuTKdqlo0lgO/UR+aLezA2 23jBrJrQZkK6tcocJMum31f7hKqiFx3T6tabn308W5E4pAhF07CF23Glnc/Q X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Sep 2026 20:03:49 -0400 (EDT) Date: Wed, 9 Sep 2026 09:03:46 +0900 From: Michael Paquier To: Greg Burd Cc: PostgreSQL Hackers , Andres Freund Subject: Re: ExecForceStoreHeapTuple() loses tts_tid, so ORDER BY-op index scans project an invalid ctid Message-ID: References: <0498c10f-839b-4f68-9994-c29b454e55a4@app.fastmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="b6IriMXzyJmY7SCB" Content-Disposition: inline In-Reply-To: <0498c10f-839b-4f68-9994-c29b454e55a4@app.fastmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --b6IriMXzyJmY7SCB Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 08, 2026 at 01:28:22PM -0400, Greg Burd wrote: > ExecForceStoreHeapTuple() does not set slot->tts_tid when the target > slot is a TTS_IS_BUFFERTUPLE slot. Any plan that re-stores a heap tuple > through it and then projects ctid therefore gets (4294967295,0) instead > of the row's real heap TID. Oops. =20 My question would be what kind of testing you have done to spot that.. > ExecClearTuple() reaches tts_buffer_heap_clear(), which does > ItemPointerSetInvalid(&slot->tts_tid). The tuple is then copied in, but > tts_tid is left invalid. The sibling path, ExecStoreHeapTuple() -> > tts_heap_store_tuple() =E2=80=94 *does* slot->tts_tid =3D tuple->t_self, = so this > reads as a plain asymmetry rather than an intentional choice. That's strange. Once thing that I can see why scanning this file is the same code pattern in tts_buffer_heap_copyslot(), where a slot is similarly cleared in a copy-paste fashion. Andres? -- Michael --b6IriMXzyJmY7SCB Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmqgomIACgkQnvQgOdby QH2wKRAAlQwoHY6lZsdjeumm50Yx4wYsRaEnPs0GtlzWsSd2XZtaputebGGjVDpp T/rCSdxsO9h8fsh4HPY5R4OJytGOxqsDOoIkaFZKYAJlhUYayZxDpyqvUfz6DEtD 7ifefPp/GWiV+pCDFEpGS/WdKuEcb9NQ0duqrv0cxN/PaZ1VEWSaZ0hv0R+c6PN0 eubNbSICdCIpQX7XFKC3v4+Mxd2tGi+2MDiOZ2NCg36KfVCCDNfNqsDRb0Xx0iMQ aUyf0O472PbYEDIbqzBVeDw+5nda+gwKHHIZ4tKjACDtjDdT+/gIi+wZ3LKomoT7 7iG3bTEfDBhrphkHRRqyJ+Mpu1QKabnbyJdCuoI/AjF9Wwa+H8BfJVWzU/BrAk7+ 2379qR9wCg2b06n3v1nSioKV4+g93nkaSiMcZ9xXGevvt0QVQRPcnREIqx89BUlI u6aCyqJoWRvXOWK6xtTkJ0VAPdO2hmLT418iU7SQTXwDQ0GRXzlFNfIzOQLHOm6r GyAce0ExkCT91roAMB3MkvSBX0q1u4lpRj6FmHy8tyCdEemxisBxkeE8G8eqKcBf woJf51YpPVjmpblQdYhfpqNI5HxRmFFG2G0lkDwI7UW7/HqYqcH3G0PvNuTKRIkh LJP4Cb7xSMpwEBOoqf+FglYOmttew7m/jZC9cjz0/RceIRgbOXU= =XsGN -----END PGP SIGNATURE----- --b6IriMXzyJmY7SCB--