| From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
|---|---|
| To: | Rahul <rahul(at)rhyadav(dot)dev> |
| Cc: | Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)com>, Samuel Olaoye <dapsalmy(at)gmail(dot)com>, Pgsql Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Wrong results: hashed SubPlan referenced twice after OR-qual extraction reuses a stale hash table (13 to 19beta4) |
| Date: | 2026-10-30 07:24:55 |
| Message-ID: | CAMbWs4_MMevwC_Q25yCFqFrxia-PNuvNRakaK6BDAV6K7k=nJw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Sat, Oct 17, 2026 at 9:06 PM Rahul <rahul(at)rhyadav(dot)dev> wrote:
> With v2, the regression, isolation and contrib tests pass (I haven't
> run the TAP tests). I still owe back-branch versions; I'll post them
> once the master version is settled.
Nice catch! The fix in v2 looks good to me.
I'm not very happy with the test case though. You don't need an OR
clause to hit this bug. It can happen whenever the same hashed
SubPlan is referenced more than once in the plan, so we can use a much
simpler query. Also, we should avoid creating new tables in the tests
if existing ones can do the job.
Also, I don't quite like the comments. They mainly explain why we no
longer look at the subplan's chgParam, which is really about the code
being removed. I think the comments should describe what the code
does now, and the history can go in the commit message.
v3 attached. Unless there are objections, I'll push it and back-patch
to 14 before the upcoming minor releases.
- Richard
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Fix-reuse-of-stale-hash-tables-by-duplicated-hash.patch | application/octet-stream | 7.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tender Wang | 2026-10-30 07:27:36 | Re: BUG #19805: Wrong results: self-join elimination drops an ORDER BY sort key with GROUPING SETS / CUBE / ROLLUP |
| Previous Message | PG Bug reporting form | 2026-10-30 07:01:30 | BUG #19821: pg_restore_attribute_stats() accepts an unsorted scalar histogram_bounds, producing badly wrong row |