mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Improve commentary about ChangeVarNodesWalkExpression().
IMO the proximate cause of the bug fixed in commit 07b7a964d
was sloppy thinking about what ChangeVarNodesWalkExpression()
is to be used for. Flesh out its header comment to try to
improve that situation.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1607553.1774017006@sss.pgh.pa.us
Backpatch-through: 18
This commit is contained in:
parent
0852643e1c
commit
a0e0b3cc68
1 changed files with 11 additions and 4 deletions
|
|
@ -671,7 +671,7 @@ ChangeVarNodes_walker(Node *node, ChangeVarNodes_context *context)
|
|||
* value indicating if the given node should be skipped from further processing
|
||||
* by ChangeVarNodes_walker. The callback is called only for expressions and
|
||||
* other children nodes of a Query processed by a walker. Initial processing
|
||||
* of the root Query doesn't involve the callback.
|
||||
* of the root Query node doesn't invoke the callback.
|
||||
*/
|
||||
void
|
||||
ChangeVarNodesExtended(Node *node, int rt_index, int new_index,
|
||||
|
|
@ -736,9 +736,16 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
|
|||
}
|
||||
|
||||
/*
|
||||
* ChangeVarNodesWalkExpression - process expression within the custom
|
||||
* callback provided to the
|
||||
* ChangeVarNodesExtended.
|
||||
* ChangeVarNodesWalkExpression - process subexpression within a callback
|
||||
* function passed to ChangeVarNodesExtended.
|
||||
*
|
||||
* This is intended to be used by a callback that needs to recursively
|
||||
* process subexpressions of some node being visited by an outer
|
||||
* ChangeVarNodesExtended call (not letting ChangeVarNodes_walker do that).
|
||||
* Hence, we invoke ChangeVarNodes_walker directly. This means that if
|
||||
* the passed Node is a Query node, it will be treated as a sub-Query,
|
||||
* so sublevels_up will be incremented immediately. Do not apply this
|
||||
* to a top-level Query node, or you'll likely get wrong results.
|
||||
*/
|
||||
bool
|
||||
ChangeVarNodesWalkExpression(Node *node, ChangeVarNodes_context *context)
|
||||
|
|
|
|||
Loading…
Reference in a new issue