From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: shihao zhong <zhong950419@gmail.com>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Melanie Plageman <melanieplageman@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Subject: Re: Fix ReadStream handling when heap rescan strategy changes
Date: Wed, 4 Nov 2026 08:37:48 +0000
Message-ID: <auru3LY+yQtf6QIk@bdtpg> (raw)
In-Reply-To: <CAGRkXqSX6PzrydJ6OeOOiYC+GKT_uhmivG+AB3uO+emTubv8wA@mail.gmail.com>
References: <aumB7BHGWewR4x/S@bdtpg>
<CAN55FZ39VCnt3xtnKpCve0h0p5dzDaZLpGetvTggmGCPN2RE5A@mail.gmail.com>
<CAGRkXqSX6PzrydJ6OeOOiYC+GKT_uhmivG+AB3uO+emTubv8wA@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: bertranddrouvot.pg@gmail.com, zhong950419@gmail.com, byavuz81@gmail.com, melanieplageman@gmail.com, thomas.munro@gmail.com
Subject: Re: Fix ReadStream handling when heap rescan strategy changes
In-Reply-To: <auru3LY+yQtf6QIk@bdtpg>
References: <aumB7BHGWewR4x/S@bdtpg> <CAN55FZ39VCnt3xtnKpCve0h0p5dzDaZLpGetvTggmGCPN2RE5A@mail.gmail.com> <CAGRkXqSX6PzrydJ6OeOOiYC+GKT_uhmivG+AB3uO+emTubv8wA@mail.gmail.com> <auru3LY+yQtf6QIk@bdtpg>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox