mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Partial fix for copied-plan bugs reported by Hiroshi Inoue:
_copyResult didn't copy subPlan structure completely. _copyAgg is still busted, apparently because of changes from EXCEPT/INTERSECT patch (get_agg_tlist_references is no longer sufficient to find all aggregates). No time to look at that tonight, however.
This commit is contained in:
@@ -426,6 +426,7 @@ SS_finalize_plan(Plan *plan)
|
||||
case T_Result:
|
||||
param_list = set_unioni(param_list,
|
||||
_finalize_primnode(((Result *) plan)->resconstantqual, &subPlan));
|
||||
/* subPlan is NOT necessarily NULL here ... */
|
||||
break;
|
||||
|
||||
case T_Append:
|
||||
@@ -503,10 +504,10 @@ SS_finalize_plan(Plan *plan)
|
||||
|
||||
}
|
||||
|
||||
List *SS_pull_subplan(void *expr);
|
||||
/* Construct a list of all subplans found within the given node tree */
|
||||
|
||||
List *
|
||||
SS_pull_subplan(void *expr)
|
||||
SS_pull_subplan(Node *expr)
|
||||
{
|
||||
List *result = NULL;
|
||||
|
||||
@@ -524,18 +525,18 @@ SS_pull_subplan(void *expr)
|
||||
return SS_pull_subplan(((Iter *) expr)->iterexpr);
|
||||
else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
|
||||
not_clause(expr) || is_funcclause(expr))
|
||||
return SS_pull_subplan(((Expr *) expr)->args);
|
||||
return SS_pull_subplan((Node *) ((Expr *) expr)->args);
|
||||
else if (IsA(expr, Aggref))
|
||||
return SS_pull_subplan(((Aggref *) expr)->target);
|
||||
else if (IsA(expr, ArrayRef))
|
||||
{
|
||||
result = SS_pull_subplan(((ArrayRef *) expr)->refupperindexpr);
|
||||
result = SS_pull_subplan((Node *)((ArrayRef *) expr)->refupperindexpr);
|
||||
result = nconc(result,
|
||||
SS_pull_subplan(((ArrayRef *) expr)->reflowerindexpr));
|
||||
SS_pull_subplan((Node*) ((ArrayRef *) expr)->reflowerindexpr));
|
||||
result = nconc(result,
|
||||
SS_pull_subplan(((ArrayRef *) expr)->refexpr));
|
||||
result = nconc(result,
|
||||
SS_pull_subplan(((ArrayRef *) expr)->refassgnexpr));
|
||||
SS_pull_subplan(((ArrayRef *) expr)->refassgnexpr));
|
||||
}
|
||||
else if (IsA(expr, TargetEntry))
|
||||
return SS_pull_subplan(((TargetEntry *) expr)->expr);
|
||||
|
Reference in New Issue
Block a user