diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c index 48fb32d384..c1363b4ecf 100644 --- a/src/backend/executor/nodeLimit.c +++ b/src/backend/executor/nodeLimit.c @@ -125,7 +125,7 @@ ExecLimit(LimitState *node) * the state machine state to record having done so. */ if (!node->noCount && - node->position >= node->offset + node->count) + node->position - node->offset >= node->count) { node->lstate = LIMIT_WINDOWEND; return NULL;