| From: | SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
| Subject: | [Bug]Assertion failure in LATERAL GRAPH_TABLE with multi-label pattern |
| Date: | 2026-05-07 04:13:20 |
| Message-ID: | CAHg+QDfnLzsgjaQ_CiKSpP4JH3MKOiwoawEcCzXa9uYr45yiWw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
A LATERAL GRAPH_TABLE whose pattern matches more than one path query
fails with the assert
TRAP: failed Assert("!bms_is_member(rti, lateral_relids)"), File:
"initsplan.c", Line: 1428, PID: 3586144
postgres: postgres postgres [local]
SELECT(ExceptionalCondition+0x70)[0x63488e3cc070]
postgres: postgres postgres [local]
SELECT(create_lateral_join_info+0x468)[0x63488e14ac28]
postgres: postgres postgres [local]
SELECT(query_planner+0x13a)[0x63488e14dfca]
Repro:
SELECT v1.vname, gt.aname
FROM v1, LATERAL (SELECT * FROM GRAPH_TABLE (g1 MATCH (a IS vl1 | vl2
WHERE a.vprop1 = v1.vprop1) COLUMNS (a.vname AS aname)) g) gt
ORDER BY 1, 2;
Single-label GRAPH_TABLE with the same outer reference works fine.
rewriteGraphTable() turns the GRAPH_TABLE RTE into a subquery RTE and
bumps outer Vars by one sublevel. When the pattern produces multiple
path queries, generate_setop_from_pathqueries() wraps each one in
another subquery RTE for the UNION ALL but does not bump again, so the
lateral reference collapses onto GRAPH_TABLE's own RTE.
Tried fixing this by bumping each lquery's sublevels by 1 before the
addRangeTableEntry
ForSubquery() wrap. Single-pathquery queries skip this path entirely.
Attached a patch with the tests.
Thanks,
Satya
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-assertion-failure-in-LATERAL-GRAPH_TABLE-with-mu.patch | application/octet-stream | 3.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-05-07 04:31:37 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | cca5507 | 2026-05-07 04:04:44 | Re: Why is_admin_of_role() use ROLERECURSE_MEMBERS rather than ROLERECURSE_PRIVS? |