10000 Avoid core dump in _outPathInfo() for Path without a parent RelOptInfo. · c2j/postgres@96139cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 96139cf

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 0c9391e commit 96139cf

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
@@ -1466,7 +1466,10 @@ _outPathInfo(StringInfo str, Path *node)
14661466
{
14671467
WRITE_ENUM_FIELD(pathtype, NodeTag);
14681468
appendStringInfo(str, " :parent_relids ");
1469-
_outBitmapset(str, node->parent->relids);
1469+
if (node->parent)
1470+
_outBitmapset(str, node->parent->relids);
1471+
else
1472+
_outBitmapset(str, NULL);
14701473
WRITE_FLOAT_FIELD(startup_cost, "%.2f");
14711474
WRITE_FLOAT_FIELD(total_cost, "%.2f");
14721475
WRITE_NODE_FIELD(pathkeys);

0 commit comments

Comments
 (0)
0