mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Fix comments for ChangeVarNodes() and related functions
The comment for ChangeVarNodes() refers to a parameter named change_RangeTblRef, which does not exist in the code. The comment for ChangeVarNodesExtended() contains an extra space, while the comment for replace_relid_callback() has an awkward line break and a typo. This patch fixes these issues and revises some sentences for smoother wording. Oversights in commitsab42d643candfc069a3a6. Author: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/CAMbWs480j16HC1JtjKCgj5WshivT8ZJYkOfTyZAM0POjFomJkg@mail.gmail.com Backpatch-through: 18
This commit is contained in:
@@ -1683,14 +1683,14 @@ add_non_redundant_clauses(PlannerInfo *root,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A custom callback for ChangeVarNodesExtended() providing
|
* A custom callback for ChangeVarNodesExtended() providing Self-join
|
||||||
* Self-join elimination (SJE) related functionality
|
* elimination (SJE) related functionality
|
||||||
*
|
*
|
||||||
* SJE needs to skip the RangeTblRef node
|
* SJE needs to skip the RangeTblRef node type. During SJE's last
|
||||||
* type. During SJE's last step, remove_rel_from_joinlist() removes
|
* step, remove_rel_from_joinlist() removes remaining RangeTblRefs
|
||||||
* remaining RangeTblRefs with target relid. If ChangeVarNodes() replaces
|
* with target relid. If ChangeVarNodes() replaces the target relid
|
||||||
* the target relid before, remove_rel_from_joinlist() fails to identify
|
* before, remove_rel_from_joinlist() would fail to identify the nodes
|
||||||
* the nodes to delete.
|
* to delete.
|
||||||
*
|
*
|
||||||
* SJE also needs to change the relids within RestrictInfo's.
|
* SJE also needs to change the relids within RestrictInfo's.
|
||||||
*/
|
*/
|
||||||
@@ -1769,8 +1769,8 @@ replace_relid_callback(Node *node, ChangeVarNodes_context *context)
|
|||||||
/*
|
/*
|
||||||
* For self-join elimination, changing varnos could transform
|
* For self-join elimination, changing varnos could transform
|
||||||
* "t1.a = t2.a" into "t1.a = t1.a". That is always true as long
|
* "t1.a = t2.a" into "t1.a = t1.a". That is always true as long
|
||||||
* as "t1.a" is not null. We use qual() to check for such a case,
|
* as "t1.a" is not null. We use equal() to check for such a
|
||||||
* and then we replace the qual for a check for not null
|
* case, and then we replace the qual with a check for not null
|
||||||
* (NullTest).
|
* (NullTest).
|
||||||
*/
|
*/
|
||||||
if (leftOp != NULL && equal(leftOp, rightOp))
|
if (leftOp != NULL && equal(leftOp, rightOp))
|
||||||
|
|||||||
@@ -542,8 +542,6 @@ offset_relid_set(Relids relids, int offset)
|
|||||||
* (identified by sublevels_up and rt_index), and change their varno fields
|
* (identified by sublevels_up and rt_index), and change their varno fields
|
||||||
* to 'new_index'. The varnosyn fields are changed too. Also, adjust other
|
* to 'new_index'. The varnosyn fields are changed too. Also, adjust other
|
||||||
* nodes that contain rangetable indexes, such as RangeTblRef and JoinExpr.
|
* nodes that contain rangetable indexes, such as RangeTblRef and JoinExpr.
|
||||||
* Specifying 'change_RangeTblRef' to false allows skipping RangeTblRef.
|
|
||||||
* See ChangeVarNodesExtended for details.
|
|
||||||
*
|
*
|
||||||
* NOTE: although this has the form of a walker, we cheat and modify the
|
* NOTE: although this has the form of a walker, we cheat and modify the
|
||||||
* nodes in-place. The given expression tree should have been copied
|
* nodes in-place. The given expression tree should have been copied
|
||||||
@@ -664,17 +662,16 @@ ChangeVarNodes_walker(Node *node, ChangeVarNodes_context *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ChangeVarNodesExtended - similar to ChangeVarNodes, but with an additional
|
* ChangeVarNodesExtended - similar to ChangeVarNodes, but with an additional
|
||||||
* 'callback' param
|
* 'callback' param
|
||||||
*
|
*
|
||||||
* ChangeVarNodes changes a given node and all of its underlying nodes.
|
* ChangeVarNodes changes a given node and all of its underlying nodes. This
|
||||||
* This version of function additionally takes a callback, which has a
|
* version of function additionally takes a callback, which has a chance to
|
||||||
* chance to process a node before ChangeVarNodes_walker. A callback
|
* process a node before ChangeVarNodes_walker. A callback returns a boolean
|
||||||
* returns a boolean value indicating if given node should be skipped from
|
* value indicating if the given node should be skipped from further processing
|
||||||
* further processing by ChangeVarNodes_walker. The callback is called
|
* by ChangeVarNodes_walker. The callback is called only for expressions and
|
||||||
* only for expressions and other children nodes of a Query processed by
|
* other children nodes of a Query processed by a walker. Initial processing
|
||||||
* a walker. Initial processing of the root Query doesn't involve the
|
* of the root Query doesn't involve the callback.
|
||||||
* callback.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ChangeVarNodesExtended(Node *node, int rt_index, int new_index,
|
ChangeVarNodesExtended(Node *node, int rt_index, int new_index,
|
||||||
|
|||||||
Reference in New Issue
Block a user