Re: Incremental Sort crash on a rescan that becomes bounded

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>, jtc331(at)gmail(dot)com
Subject: Re: Incremental Sort crash on a rescan that becomes bounded
Date: 2026-11-16 16:21:28
Message-ID: CAGRkXqReGJEmD-FC0ork-NL51k4JfrBPKSAyCV3Y4tnRLthj2A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi David,

Thanks for reviewing my patch

> Is the patch an AI fix?...

I recently used AI to verify all the assertions and find this issue then
I picked that direction and had it draft V1. Then I tested it myself.

> it's a pretty inefficient way to make it
> work correctly. It seems wasteful to me to have to recreate the
> tuplesort just because the boundedness requirements have changed

Agree... I copied ExecReScanSort() for V1 and did not think
about reusing the state.

I also thought about doing the tuplesort_reset direction a little bit,
but did not go with that direction.

> Maybe in master we could adjust the tuplesort_reset()
> function to take the allowbounded parameter.

I think we should do that.

I tested V2 locally and it looks good.

Thanks,
Shihao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-11-16 16:26:22 Re: extension_control_path: ignore empty elements and deduplicate directories
Previous Message Matheus Alcantara 2026-11-16 16:20:41 Re: extension_control_path: ignore empty elements and deduplicate directories