diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 0f1e2e46802..8e3a9068f1f 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -2334,7 +2334,7 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction, { *offset_est = DatumGetInt64(((Const *) est)->constvalue); if (*offset_est < 0) - *offset_est = 0; /* less than 0 is same as 0 */ + *offset_est = 0; /* treat as not present */ } } else @@ -2495,9 +2495,8 @@ limit_needed(Query *parse) { int64 offset = DatumGetInt64(((Const *) node)->constvalue); - /* Executor would treat less-than-zero same as zero */ - if (offset > 0) - return true; /* OFFSET with a positive value */ + if (offset != 0) + return true; /* OFFSET with a nonzero value */ } } else