Re: Assert failure in parallel query due to SubPlan double visit for hash join

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Assert failure in parallel query due to SubPlan double visit for hash join
Date: 2026-10-29 22:07:45
Message-ID: CAP53Pkz6ZtWGvcxzJ3QbU3yzJZ5mZdq9aTu-zesa=X3URcKh-Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Sami,

On Wed, Oct 28, 2026 at 5:17 PM Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> wrote:
> In a non-assert build, this kind of case is definitely not easy to spot,
> unless someone is really scrutinizing these parts of the plan.

Yeah, agreed - its also a somewhat unlikely plan to have, so I don't
think this is seen much in practice, and if it is, people won't
realize its wrong.

> Your patch looks fine to me. I just had a few small comments:

Thanks for reviewing!

> 1/ Maybe rename planstate_tree_collect() to something like
> planstate_tree_collect_distinct(). The important part here is that each
> distinct PlanState appears in the returned list only once, so the name should
> probably say that.

Yeah, good point on naming - if we stay with this structure I'll adjust.

> 2/ Some execParallel.c comments still read as if the functions recurse. For
> example ExecParallelRetrieveInstrumentation(),
> ExecParallelReportInstrumentation(),
> and ExecParallelInitializeWorker() now only deal with a single
> PlanState at a time.

Good point - there are a few that clearly need updating (e.g.
ExecParallelRetrieveInstrumentation jumps out), will revise.

Thanks,
Lukas

--
Lukas Fittl

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ethan Tran 2026-10-29 22:09:27 Re: Improve hash aggregate spilling by writing only the needed columns
Previous Message surya poondla 2026-10-29 20:55:45 Re: Parallel vacuum: workers together with leader could overrun cost budget