Skip to content

Commit 16bbe5a

Browse files
committed
Avoid core dump in _outPathInfo() for Path without a parent RelOptInfo.
Nearly all Paths have parents, but a ResultPath representing an empty FROM clause does not. Avoid a core dump in such cases. I believe this is only a hazard for debugging usage, not for production, else we'd have heard about it before. Nonetheless, back-patch to 9.1 where the troublesome code was introduced. Noted while poking at bug #11703.
1 parent 3205b30 commit 16bbe5a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/nodes/outfuncs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,10 @@ _outPathInfo(StringInfo str, const Path *node)
14761476
{
14771477
WRITE_ENUM_FIELD(pathtype, NodeTag);
14781478
appendStringInfoString(str, " :parent_relids ");
1479-
_outBitmapset(str, node->parent->relids);
1479+
if (node->parent)
1480+
_outBitmapset(str, node->parent->relids);
1481+
else
1482+
_outBitmapset(str, NULL);
14801483
appendStringInfoString(str, " :required_outer ");
14811484
if (node->param_info)
14821485
_outBitmapset(str, node->param_info->ppi_req_outer);

0 commit comments

Comments
 (0)