Re: Tighten asserts on ParallelWorkerNumber a little bit
Tomas Vondra <tomas@vondra.me>
From: Tomas Vondra <tomas@vondra.me>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-14T14:53:21Z
Lists: pgsql-hackers
On 3/13/26 11:53, Bertrand Drouvot wrote: > ... > >> So AFAICS the assert(s) should be >> >> Assert(ParallelWorkerNumber < node->shared_info->num_workers); > > I think that you're right. It looks like the first one has been introduced > by bf11e7ee2e3 and then the others are probably copy/paste. > >> I don't think we had issues with this not catching a bug. But it may be >> a bit misleading, so worth fixing and (probably) backpatching. > > I do agree. > > With that patch applied, the remaining one: > > $ git grep "<=.*num_workers" > src/backend/executor/nodeGatherMerge.c: Assert(nreaders <= castNode(GatherMerge, gm_state->ps.plan)->num_workers); > > does not need to be fixed, so I think that your patch does not miss any and > LGTM. > Thanks. Pushed and backpatched. -- Tomas Vondra
Commits
-
Tighten asserts on ParallelWorkerNumber
- ff78b8fac46e 14.23 landed
- 34baa313e317 15.18 landed
- 6fab4fa541a7 16.14 landed
- 2fa42feb7921 17.10 landed
- 0e5ff9b9b45a 18.4 landed
- 02eecead8678 19 (unreleased) landed