summaryrefslogtreecommitdiffstats
path: root/src/backend/utils/adt/int8.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:16:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:16:19 +0000
commit31176cd686f31dcb71392f6583f7b8d9cef63770 (patch)
tree27fefbaada5177e179c6cf8806be49dfe613d5f4 /src/backend/utils/adt/int8.c
parentAdding upstream version 16.2. (diff)
downloadpostgresql-16-31176cd686f31dcb71392f6583f7b8d9cef63770.tar.xz
postgresql-16-31176cd686f31dcb71392f6583f7b8d9cef63770.zip
Adding upstream version 16.3.upstream/16.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/backend/utils/adt/int8.c')
-rw-r--r--src/backend/utils/adt/int8.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c
index 123b4eb..41fbeec 100644
--- a/src/backend/utils/adt/int8.c
+++ b/src/backend/utils/adt/int8.c
@@ -833,6 +833,21 @@ int8inc_support(PG_FUNCTION_ARGS)
SupportRequestWFuncMonotonic *req = (SupportRequestWFuncMonotonic *) rawreq;
MonotonicFunction monotonic = MONOTONICFUNC_NONE;
int frameOptions = req->window_clause->frameOptions;
+ WindowFunc *wfunc = req->window_func;
+
+ if (list_length(wfunc->args) == 1)
+ {
+ Node *expr = eval_const_expressions(NULL, linitial(wfunc->args));
+
+ /*
+ * Due to the Node representation of WindowClause runConditions in
+ * version prior to v17, we need to insist that the count arg is
+ * Const to allow safe application of the runCondition
+ * optimization.
+ */
+ if (!IsA(expr, Const))
+ PG_RETURN_POINTER(NULL);
+ }
/* No ORDER BY clause then all rows are peers */
if (req->window_clause->orderClause == NIL)