Remove unused parameter form find_window_run_conditions()

Started by Matheus Alcantara3 months ago2 messages
#1Matheus Alcantara
matheusssilv97@gmail.com
1 attachment(s)

Hi,

Reading find_window_run_conditions() the RangeTableEntry *rte parameter
is not being used by find_window_run_conditions() and
check_and_push_window_quals(). The attached patch remove this parameter
from both functions.

The 4be9024d573 also remove unused parameter for both functions and
after studying more these functions I founded that the RangeTableEntry
is not being used as well. I've checked the other parameters and all
seems to be used now.

--
Matheus Alcantara

Attachments:

0001-Remove-unused-parameter-from-find_window_run_conditi.patchtext/plain; charset=utf-8; name=0001-Remove-unused-parameter-from-find_window_run_conditi.patchDownload
From 0eab4399507f3cb6ff4e0d1429089280d2136621 Mon Sep 17 00:00:00 2001
From: Matheus Alcantara <mths.dev@pm.me>
Date: Mon, 29 Sep 2025 10:14:50 -0300
Subject: [PATCH] Remove unused parameter from find_window_run_conditions()

... and check_and_push_window_quals()
---
 src/backend/optimizer/path/allpaths.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 132e8a35a39..12925a115dd 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -2254,8 +2254,8 @@ set_dummy_rel_pathlist(RelOptInfo *rel)
  * return false.
  */
 static bool
-find_window_run_conditions(Query *subquery, RangeTblEntry *rte,
-						   AttrNumber attno, WindowFunc *wfunc, OpExpr *opexpr,
+find_window_run_conditions(Query *subquery, AttrNumber attno,
+						   WindowFunc *wfunc, OpExpr *opexpr,
 						   bool wfunc_left, bool *keep_original,
 						   Bitmapset **run_cond_attrs)
 {
@@ -2445,7 +2445,7 @@ find_window_run_conditions(Query *subquery, RangeTblEntry *rte,
  * will use the runCondition to stop returning tuples.
  */
 static bool
-check_and_push_window_quals(Query *subquery, RangeTblEntry *rte, Node *clause,
+check_and_push_window_quals(Query *subquery, Node *clause,
 							Bitmapset **run_cond_attrs)
 {
 	OpExpr	   *opexpr = (OpExpr *) clause;
@@ -2485,7 +2485,7 @@ check_and_push_window_quals(Query *subquery, RangeTblEntry *rte, Node *clause,
 		TargetEntry *tle = list_nth(subquery->targetList, var1->varattno - 1);
 		WindowFunc *wfunc = (WindowFunc *) tle->expr;
 
-		if (find_window_run_conditions(subquery, rte, tle->resno, wfunc,
+		if (find_window_run_conditions(subquery, tle->resno, wfunc,
 									   opexpr, true, &keep_original,
 									   run_cond_attrs))
 			return keep_original;
@@ -2498,7 +2498,7 @@ check_and_push_window_quals(Query *subquery, RangeTblEntry *rte, Node *clause,
 		TargetEntry *tle = list_nth(subquery->targetList, var2->varattno - 1);
 		WindowFunc *wfunc = (WindowFunc *) tle->expr;
 
-		if (find_window_run_conditions(subquery, rte, tle->resno, wfunc,
+		if (find_window_run_conditions(subquery, tle->resno, wfunc,
 									   opexpr, false, &keep_original,
 									   run_cond_attrs))
 			return keep_original;
@@ -2622,7 +2622,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
 					 * runCondition.
 					 */
 					if (!subquery->hasWindowFuncs ||
-						check_and_push_window_quals(subquery, rte, clause,
+						check_and_push_window_quals(subquery, clause,
 													&run_cond_attrs))
 					{
 						/*
-- 
2.50.1 (Apple Git-155)

#2David Rowley
dgrowleyml@gmail.com
In reply to: Matheus Alcantara (#1)
Re: Remove unused parameter form find_window_run_conditions()

On Tue, 30 Sept 2025 at 02:23, Matheus Alcantara
<matheusssilv97@gmail.com> wrote:

Reading find_window_run_conditions() the RangeTableEntry *rte parameter
is not being used by find_window_run_conditions() and
check_and_push_window_quals(). The attached patch remove this parameter
from both functions.

The 4be9024d573 also remove unused parameter for both functions and
after studying more these functions I founded that the RangeTableEntry
is not being used as well. I've checked the other parameters and all
seems to be used now.

Well, I guess we'd better remove that one too. Thanks for the patch.

This time I checked the remaining ones, and it seems there are no
other unused ones this time.

Pushed.

David