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.98.2) (envelope-from ) id 1xOWVI-00000000Bsq-2S3E for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Nov 2026 08:37:58 +0000 Received: from localhost ([127.0.0.1]:52282 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xOWVH-00000004qSK-0kNe for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Nov 2026 08:37:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:57782) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xOWVG-00000004qSC-34hV for pgsql-hackers@lists.postgresql.org; Wed, 04 Nov 2026 08:37:54 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xOWVD-000000009eF-1bvE for pgsql-hackers@lists.postgresql.org; Wed, 04 Nov 2026 08:37:53 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4a35db1f202so2521025e9.3 for ; Wed, 04 Nov 2026 00:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793781470; x=1794386270; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=u7QoEPTgfZBAb+MMMwYzqPKmSdPWCA2D8mIMJ63AJWc=; b=b+wK3jdNUslXGlQvAOortzSzL6rgNS0mVy9tt/DF2VBd41eMcQJObj/7OFhJb70bsn Ahngvo3ViDeU5MUKOQg3/m3jpaapDrPc5mls4Ah8xB6CuWIZt+wD13kdMHt8u3OUKrAA ccCIQGpEzRRSies/jKMeesu6SgrInuKhzbEEPheo6HVwCNlONTH9vrYWvRE5j9y57++s XJ9q9Dkurx18dzjH5zcVTviU2bMm8rZyt/Y+HE3nKlx5R8xmwQwkk3NPXl4PLkIiJ7jY dEO5iJNlALQngw4fj/MrYPB5B0d3zJ0kxl957TwaE+etudu0BjB2zJtKl0kUQtHh+oAJ jOFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793781470; x=1794386270; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=u7QoEPTgfZBAb+MMMwYzqPKmSdPWCA2D8mIMJ63AJWc=; b=dn+Lg7bGGO42nisfRMobC6ruspxovRCr7yxt+s66AdfEU124teK/MT2W+M1SKMUJpN AM8U1MFkV434aaVTZspKVPODbpqPqJG7rcPqltXoxJOemIVKxsgKOpmzsJoc2qctPwSG zDpl5svqwP0oUu3Bym//utADOORD5TcuRYCE3F5tUdIXiAwFC1vGyemwNmd2FoUYQfH2 PMpbYb5s/Io2GcJWRHSctlysxXNQKBfVhFBrpl9wQ67eyMbNiX+m4JLMEzc+UJz6cAWu /bvMT+qqutlpdqs/V4z7DEaCLLIqoexdhXqHqHaOVxv/ZgGdi8KfsUSrNQwP6I5N11ij RBUw== X-Forwarded-Encrypted: i=1; AKwUvBzmnNAv6fsfmEDjABdecOfTQNV/1cDkbLIg7ch5J06hJ28CyiQZqB0Fznr+bizOBkM3Rc8VKCiSBx1VrBMz@lists.postgresql.org X-Gm-Message-State: APuU4Z/gRTBGIqrnecC5S8nduuX7YQnSWqCCiAq6KygH+BG2GOeatCOq H08DcoosP84je8kL5rB64r8gTeHq/yKL7dEpY/wHz2eJcwlP1fI3RkkA X-Gm-Gg: AYBFou0kVQtbpp2hbj7eRSWr0Tr6usljfCAFZmBJroOO7rJMT1Dp5DtQWmwv65XhzFj LWN1fz2H6/gwG7Z9nnUQPnDGmabU7OsuGuxahEnAWeboUjjnuCFWG/9Yd8UCfNmsJeZxHv+4jxc RsTZjOlr+UzYbuGBp3gQ9XR+kNNZFxCrzBrJUOaK7xYUwvRHLbVJa0O5pEogyk6Kc2eA2CCBeNB DQa8nMN83TlQ3QX2FscnCeoQ9JkAQaVjqABC0zhPGGB56TXBiyfdJGfMWCWdm69vDcab6UFhtQC sRwKx3NOwJtxN9+uzG7a8ueO9X0lHBlLC88YnDInOWfXbTXe8pyh6WPf2nAF2o1k0kxT84YsKHl /Hx3RAQ+FAR5IteAzjou2+igYKWdRsFBho1DzVYrcPD9l1YkmvAEcNvEaBPvGRVyJRRWr/oLF3u Luq+YUfEEE7pPHVPW11KjAbOFHr6U5T8h2W6czRZDKszo+2/TueNCyMJiFzoCD3Z0dtsjxtOgQe SoXl2LHtotEdBEV3qnttkXXAanrTA15mieLg/1pncJnMiqM7Cb1gsg+FlttKeLaCFbTnc573afA Ir4Dz7QYLwtFfby+5/3FMppGA5+L+qivG/wjEIkI/LYFlrB8NfsMOsWyllK5Lkk8GfA/XEXFB1j c13tX8MqLiBU= X-Received: by 2002:a05:600c:6215:b0:4a1:a45a:88f with SMTP id 5b1f17b1804b1-4ac187a6c3amr330752025e9.20.1793781469891; Wed, 04 Nov 2026 00:37:49 -0800 (PST) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4b412e48fd8sm36315515e9.1.2026.11.04.00.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 00:37:49 -0800 (PST) Date: Wed, 4 Nov 2026 08:37:48 +0000 From: Bertrand Drouvot To: shihao zhong Cc: Nazir Bilal Yavuz , pgsql-hackers@lists.postgresql.org, Melanie Plageman , Thomas Munro Subject: Re: Fix ReadStream handling when heap rescan strategy changes Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Shihao, On Tue, Nov 03, 2026 at 10:32:25PM -0500, shihao zhong wrote: > Hi Bertrand, > > I am not sure the dangling pointer case can happen on master today. > > initscan() only frees the strategy if SO_ALLOW_STRAT gets cleared or > the table drops below NBuffers / 4. The only caller of > table_rescan_set_params() is SampleScan, and a sample scan has no read > stream on master. > > I don't think the table can shrink either, because truncation takes an AE > today. Thanks for looking at it! I think that an extension can trigger it without shrinking the relation: start a large sequential scan with allow_strat = true, then call table_rescan_set_params() with allow_strat = false. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com