Remove unused parameter on check_and_push_window_quals
Hi,
While reading the check_and_push_window_quals() I realize that the Index
rti parameter is not being used by check_and_push_window_quals() and
find_window_run_conditions(). The attached patch remove this parameter
for these functions.
--
Matheus Alcantara
Attachments:
0001-Remove-unused-Index-rti-on-check_and_push_window_qua.patchtext/plain; charset=utf-8; name=0001-Remove-unused-Index-rti-on-check_and_push_window_qua.patchDownload
From 80a580a73fbc12200ea19e112ad1a583cec2d466 Mon Sep 17 00:00:00 2001
From: Matheus Alcantara <mths.dev@pm.me>
Date: Thu, 25 Sep 2025 17:54:48 -0300
Subject: [PATCH] Remove unused Index rti on check_and_push_window_quals
---
src/backend/optimizer/path/allpaths.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 4e1c7084c88..dfd661c9e3b 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -2253,7 +2253,7 @@ set_dummy_rel_pathlist(RelOptInfo *rel)
* return false.
*/
static bool
-find_window_run_conditions(Query *subquery, RangeTblEntry *rte, Index rti,
+find_window_run_conditions(Query *subquery, RangeTblEntry *rte,
AttrNumber attno, WindowFunc *wfunc, OpExpr *opexpr,
bool wfunc_left, bool *keep_original,
Bitmapset **run_cond_attrs)
@@ -2444,7 +2444,7 @@ find_window_run_conditions(Query *subquery, RangeTblEntry *rte, Index rti,
* will use the runCondition to stop returning tuples.
*/
static bool
-check_and_push_window_quals(Query *subquery, RangeTblEntry *rte, Index rti,
+check_and_push_window_quals(Query *subquery, RangeTblEntry *rte,
Node *clause, Bitmapset **run_cond_attrs)
{
OpExpr *opexpr = (OpExpr *) clause;
@@ -2484,7 +2484,7 @@ check_and_push_window_quals(Query *subquery, RangeTblEntry *rte, Index rti,
TargetEntry *tle = list_nth(subquery->targetList, var1->varattno - 1);
WindowFunc *wfunc = (WindowFunc *) tle->expr;
- if (find_window_run_conditions(subquery, rte, rti, tle->resno, wfunc,
+ if (find_window_run_conditions(subquery, rte, tle->resno, wfunc,
opexpr, true, &keep_original,
run_cond_attrs))
return keep_original;
@@ -2497,7 +2497,7 @@ check_and_push_window_quals(Query *subquery, RangeTblEntry *rte, Index rti,
TargetEntry *tle = list_nth(subquery->targetList, var2->varattno - 1);
WindowFunc *wfunc = (WindowFunc *) tle->expr;
- if (find_window_run_conditions(subquery, rte, rti, tle->resno, wfunc,
+ if (find_window_run_conditions(subquery, rte, tle->resno, wfunc,
opexpr, false, &keep_original,
run_cond_attrs))
return keep_original;
@@ -2621,7 +2621,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
* runCondition.
*/
if (!subquery->hasWindowFuncs ||
- check_and_push_window_quals(subquery, rte, rti, clause,
+ check_and_push_window_quals(subquery, rte, clause,
&run_cond_attrs))
{
/*
--
2.39.5 (Apple Git-154)
On Fri, 26 Sept 2025 at 09:01, Matheus Alcantara
<matheusssilv97@gmail.com> wrote:
While reading the check_and_push_window_quals() I realize that the Index
rti parameter is not being used by check_and_push_window_quals() and
find_window_run_conditions(). The attached patch remove this parameter
for these functions.
Thanks. I'll have a look at this.
David
On Fri, 26 Sept 2025 at 09:50, David Rowley <dgrowleyml@gmail.com> wrote:
On Fri, 26 Sept 2025 at 09:01, Matheus Alcantara
<matheusssilv97@gmail.com> wrote:While reading the check_and_push_window_quals() I realize that the Index
rti parameter is not being used by check_and_push_window_quals() and
find_window_run_conditions(). The attached patch remove this parameter
for these functions.Thanks. I'll have a look at this.
Seems to have been around since that feature was added. Thanks for
noticing. Pushed.
David