mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Handle WindowClause.runCondition in tree walker/mutator functions.
Commit9d9c02ccd
, which added the notion of a "run condition" for window functions, neglected to teach nodeFuncs.c to process the new field. Remarkably, that doesn't seem to have had any ill effects before we invented Var.varnullingrels, but now it can cause visible failures in join-removal scenarios. I have no faith that there's not reachable problems in v15 too, so back-patch the code change to v15 where9d9c02ccd
came in. The test case seems irrelevant to v15, though. Per bug #18277 from Zuming Jiang. Diagnosis and patch by Richard Guo. Discussion: https://postgr.es/m/18277-089ead83b329a2fd@postgresql.org
This commit is contained in:
@ -2180,6 +2180,8 @@ expression_tree_walker(Node *node,
|
||||
return true;
|
||||
if (walker(wc->endOffset, context))
|
||||
return true;
|
||||
if (walker(wc->runCondition, context))
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case T_CTECycleClause:
|
||||
@ -2457,6 +2459,8 @@ query_tree_walker(Query *query,
|
||||
return true;
|
||||
if (walker(wc->endOffset, context))
|
||||
return true;
|
||||
if (walker(wc->runCondition, context))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3094,6 +3098,7 @@ expression_tree_mutator(Node *node,
|
||||
MUTATE(newnode->orderClause, wc->orderClause, List *);
|
||||
MUTATE(newnode->startOffset, wc->startOffset, Node *);
|
||||
MUTATE(newnode->endOffset, wc->endOffset, Node *);
|
||||
MUTATE(newnode->runCondition, wc->runCondition, List *);
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
@ -3423,6 +3428,7 @@ query_tree_mutator(Query *query,
|
||||
FLATCOPY(newnode, wc, WindowClause);
|
||||
MUTATE(newnode->startOffset, wc->startOffset, Node *);
|
||||
MUTATE(newnode->endOffset, wc->endOffset, Node *);
|
||||
MUTATE(newnode->runCondition, wc->runCondition, List *);
|
||||
|
||||
resultlist = lappend(resultlist, (Node *) newnode);
|
||||
}
|
||||
|
Reference in New Issue
Block a user