Re: [PG19] Stale state after the join removal restart gives wrong results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Guofenglinux <guofenglinux(at)gmail(dot)com>
Subject: Re: [PG19] Stale state after the join removal restart gives wrong results
Date: 2026-10-13 04:34:35
Message-ID: 651978.1791866075@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> shihao zhong <zhong950419(at)gmail(dot)com> writes:
>> 1. adjust_group_pathkeys_for_groupagg() sets aggpresorted on the
>> aggregates it picks and nothing clears it. When self join elimination
>> removes a rel and the second pass picks a different presorted group,
>> the stale flag makes the executor skip the sort.

> Hmm. I've not looked at exactly what that function does, but just
> going by the name, why is it being called inside the restart loop
> rather than later? I feel like anything to do with identifying
> pathkeys could/should wait till after join removal.

Concretely, the attached fixes the given test case and passes
check-world; but I've not tried harder than that to break it.

regards, tom lane

Attachment Content-Type Size
wip-delay-calling-qp_callback.patch text/x-diff 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dhruv Aron 2026-10-13 04:38:11 Re: Restructured Shared Buffer Hash Table
Previous Message Michael Paquier 2026-10-13 04:31:39 Re: [PG19] pg_dump --statistics restores extended statistics by attribute number