Re: Fix ReadStream handling when heap rescan strategy changes

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Fix ReadStream handling when heap rescan strategy changes
Date: 2026-11-04 08:37:48
Message-ID: auru3LY+yQtf6QIk@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2026-11-04 08:42:22 possible bug - xmlconcat is badly marked as immutable
Previous Message vignesh C 2026-11-04 08:28:15 Re: Hash index corruption and CLOG lookup errors from checkpoint races