pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path
4+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2026-10-29 abda2a2c9b d9701ac316 cc4bf6e9ac 85a3871589 dd9f55249a 22cc38fd7a b0fa692801 Empty partial_pathlist when unsetting consider_parallel flag
* BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path
@ 2026-10-28 13:06 PG Bug reporting form <noreply@postgresql.org>
2026-10-29 01:22 ` Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path David Rowley <dgrowleyml@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: PG Bug reporting form @ 2026-10-28 13:06 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: gowthamdoma18@gmail.com
The following bug has been logged on the website:
Bug reference: 19803
Logged by: Gowtham Reddy
Email address: gowthamdoma18@gmail.com
PostgreSQL version: 17.11
Operating system: Ubuntu 22.04 (WSL2), x86_64, built with --enable-c
Description:
On an assert-enabled build this query crashes the backend:
CREATE TABLE pi (a int);
CREATE TABLE pi_child () INHERITS (pi);
WITH c1 AS (SELECT 1 FROM pi WHERE true UNION ALL SELECT 1 FROM pi WHERE
false),
c2 AS MATERIALIZED (SELECT 1)
SELECT 1 FROM c1 UNION ALL SELECT 2 FROM c2;
TRAP: failed Assert("!parallel_aware || pathnode->path.parallel_safe"),
File: "pathnode.c", Line: 1439 (master 4848fd675; line 1328 on 17.11)
Reproduced on 17.11 and master (4848fd675, 2026-10-28), default settings.
A release build (18.6) returns the expected rows.
Needed: an inheritance parent with a child (a plain table does not crash);
the
inlined CTE being a UNION ALL with a constant-false branch (with only true
branches it does not crash); the outer UNION ALL including a MATERIALIZED
CTE
scan. Writing the first branch as a FROM subquery instead of a CTE does not
crash. It looks like a parallel-aware Append is built although one of its
children is not parallel-safe.
Found by a grammar-based SQL fuzzer (university course project); the script
above is the hand-reduced test case.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path
2026-10-28 13:06 BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path PG Bug reporting form <noreply@postgresql.org>
@ 2026-10-29 01:22 ` David Rowley <dgrowleyml@gmail.com>
2026-10-29 01:31 ` Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path Gowtham Reddy <gowthamdoma18@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: David Rowley @ 2026-10-29 01:22 UTC (permalink / raw)
To: gowthamdoma18@gmail.com; pgsql-bugs@lists.postgresql.org
On Thu, 29 Oct 2026 at 05:25, PG Bug reporting form
<noreply@postgresql.org> wrote:
> CREATE TABLE pi (a int);
> CREATE TABLE pi_child () INHERITS (pi);
> WITH c1 AS (SELECT 1 FROM pi WHERE true UNION ALL SELECT 1 FROM pi WHERE
> false),
> c2 AS MATERIALIZED (SELECT 1)
> SELECT 1 FROM c1 UNION ALL SELECT 2 FROM c2;
>
> TRAP: failed Assert("!parallel_aware || pathnode->path.parallel_safe"),
> File: "pathnode.c", Line: 1439 (master 4848fd675; line 1328 on 17.11)
Thanks for reporting this. It looks like this happens because there's
a childrel with partial_paths that's marked as consider_parallel =
false. add_paths_to_append_rel() doesn't check if childrel has
consider_parallel == true before looking at the partial_pathlist. It
expects that's empty when the childrel is consider_parallel == false.
Looks like we can just delete the partial_pathlist when
consider_parallel gets set to false. That's what most other places do
when doing rel->consider_parallel = false; Check
apply_scanjoin_target_to_paths(). This doesn't seem to need to be done
in set_append_rel_size().
Draft patch attached.
David
Attachments:
nullify_partial_pathlist_when_unsetting_consider_parallel.patch (application/octet-stream, 896B) download
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 295e3509c74..72ad61e8c24 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -1348,10 +1348,15 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
* If set_append_rel_size() decided the parent appendrel was
* parallel-unsafe at some point after visiting this child rel, we
* need to propagate the unsafety marking down to the child, so that
- * we don't generate useless partial paths for it.
+ * we don't generate useless partial paths for it. Also, zap any
+ * partial paths that already exist from places such as
+ * set_subquery_pathlist().
*/
if (!rel->consider_parallel)
+ {
+ childrel->partial_pathlist = NIL;
childrel->consider_parallel = false;
+ }
/*
* Compute the child's access paths.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path
2026-10-28 13:06 BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path PG Bug reporting form <noreply@postgresql.org>
2026-10-29 01:22 ` Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path David Rowley <dgrowleyml@gmail.com>
@ 2026-10-29 01:31 ` Gowtham Reddy <gowthamdoma18@gmail.com>
2026-10-29 03:23 ` Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path David Rowley <dgrowleyml@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Gowtham Reddy @ 2026-10-29 01:31 UTC (permalink / raw)
To: David Rowley <dgrowleyml@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org
Hi David,
Thanks for the quick analysis and the draft patch.
I applied it on master at 4848fd675 (assert-enabled build). The
reproducer from my report no longer crashes and returns the expected
row, also with debug_parallel_query = on. The original, larger test
case from the fuzzer that led to this report also runs without the
assertion failure, and "make check" passes.
Regards,
Gowtham
On Thu, 29 Oct 2026 at 06:52, David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Thu, 29 Oct 2026 at 05:25, PG Bug reporting form
> <noreply@postgresql.org> wrote:
> > CREATE TABLE pi (a int);
> > CREATE TABLE pi_child () INHERITS (pi);
> > WITH c1 AS (SELECT 1 FROM pi WHERE true UNION ALL SELECT 1 FROM pi WHERE
> > false),
> > c2 AS MATERIALIZED (SELECT 1)
> > SELECT 1 FROM c1 UNION ALL SELECT 2 FROM c2;
> >
> > TRAP: failed Assert("!parallel_aware || pathnode->path.parallel_safe"),
> > File: "pathnode.c", Line: 1439 (master 4848fd675; line 1328 on 17.11)
>
> Thanks for reporting this. It looks like this happens because there's
> a childrel with partial_paths that's marked as consider_parallel =
> false. add_paths_to_append_rel() doesn't check if childrel has
> consider_parallel == true before looking at the partial_pathlist. It
> expects that's empty when the childrel is consider_parallel == false.
> Looks like we can just delete the partial_pathlist when
> consider_parallel gets set to false. That's what most other places do
> when doing rel->consider_parallel = false; Check
> apply_scanjoin_target_to_paths(). This doesn't seem to need to be done
> in set_append_rel_size().
>
> Draft patch attached.
>
> David
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path
2026-10-28 13:06 BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path PG Bug reporting form <noreply@postgresql.org>
2026-10-29 01:22 ` Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path David Rowley <dgrowleyml@gmail.com>
2026-10-29 01:31 ` Re: BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path Gowtham Reddy <gowthamdoma18@gmail.com>
@ 2026-10-29 03:23 ` David Rowley <dgrowleyml@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: David Rowley @ 2026-10-29 03:23 UTC (permalink / raw)
To: Gowtham Reddy <gowthamdoma18@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org
On Thu, 29 Oct 2026 at 14:32, Gowtham Reddy <gowthamdoma18@gmail.com> wrote:
> I applied it on master at 4848fd675 (assert-enabled build). The
> reproducer from my report no longer crashes and returns the expected
> row, also with debug_parallel_query = on. The original, larger test
> case from the fuzzer that led to this report also runs without the
> assertion failure, and "make check" passes.
Thanks for checking. I've pushed the patch and backpatched all the way to v14.
David
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-10-29 03:23 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 13:06 BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path PG Bug reporting form <noreply@postgresql.org>
2026-10-29 01:22 ` David Rowley <dgrowleyml@gmail.com>
2026-10-29 01:31 ` Gowtham Reddy <gowthamdoma18@gmail.com>
2026-10-29 03:23 ` David Rowley <dgrowleyml@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox