On Mon, 28 Nov 2022 16:40:52 +0900
Michael Paquier <mich...@paquier.xyz> wrote:

> On Mon, Nov 28, 2022 at 11:54:45AM +0900, Michael Paquier wrote:
> > On Fri, Nov 25, 2022 at 04:05:13PM +0800, Richard Guo wrote:
> >> I wonder if we need to revise the comment atop qual_is_pushdown_safe()
> >> too which says
> >> 
> >>  * rinfo is a restriction clause applying to the given subquery (whose RTE
> >>  * has index rti in the parent query).
> >> 
> >> since there is no 'given subquery' after we remove it from the params.
> 
> I was thinking about this point, and it seems to me that we could just
> do s/the given subquery/a subquery/.  But perhaps you have a different
> view on the matter?

+1
I also was just about to send a patch updated as so, and this is attached.

Regards,
Yugo Nagata

> --
> Michael


-- 
Yugo NAGATA <nag...@sraoss.co.jp>
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 4ddaed31a4..3ca67b0e2e 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -136,8 +136,7 @@ static void check_output_expressions(Query *subquery,
 static void compare_tlist_datatypes(List *tlist, List *colTypes,
 									pushdown_safety_info *safetyInfo);
 static bool targetIsInAllPartitionLists(TargetEntry *tle, Query *query);
-static bool qual_is_pushdown_safe(Query *subquery, Index rti,
-								  RestrictInfo *rinfo,
+static bool qual_is_pushdown_safe(Index rti, RestrictInfo *rinfo,
 								  pushdown_safety_info *safetyInfo);
 static void subquery_push_qual(Query *subquery,
 							   RangeTblEntry *rte, Index rti, Node *qual);
@@ -2527,7 +2526,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
 			Node	   *clause = (Node *) rinfo->clause;
 
 			if (!rinfo->pseudoconstant &&
-				qual_is_pushdown_safe(subquery, rti, rinfo, &safetyInfo))
+				qual_is_pushdown_safe(rti, rinfo, &safetyInfo))
 			{
 				/* Push it down */
 				subquery_push_qual(subquery, rte, rti, clause);
@@ -3787,7 +3786,7 @@ targetIsInAllPartitionLists(TargetEntry *tle, Query *query)
 /*
  * qual_is_pushdown_safe - is a particular rinfo safe to push down?
  *
- * rinfo is a restriction clause applying to the given subquery (whose RTE
+ * rinfo is a restriction clause applying to a subquery (whose RTE
  * has index rti in the parent query).
  *
  * Conditions checked here:
@@ -3813,7 +3812,7 @@ targetIsInAllPartitionLists(TargetEntry *tle, Query *query)
  * found to be unsafe to reference by subquery_is_pushdown_safe().
  */
 static bool
-qual_is_pushdown_safe(Query *subquery, Index rti, RestrictInfo *rinfo,
+qual_is_pushdown_safe(Index rti, RestrictInfo *rinfo,
 					  pushdown_safety_info *safetyInfo)
 {
 	bool		safe = true;

Reply via email to