Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit30d6a98

Browse files
committed
Re-enable error for "SELECT ... OFFSET -1".
The executor has thrown errors for negative OFFSET values since 8.4 (seecommitbfce56e), but in a moment of brainfade I taught the planner that OFFSET with a constant negative value was ano-op (commit1a1832e). Reinstate theformer behavior by only discarding OFFSET with a value of exactly 0. Inpassing, adjust a planner comment that referenced the ancient behavior.Back-patch to 9.3 where the mistake was introduced.
1 parent1ea9414 commit30d6a98

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,7 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction,
23342334
{
23352335
*offset_est=DatumGetInt64(((Const*)est)->constvalue);
23362336
if (*offset_est<0)
2337-
*offset_est=0;/*less than 0 is sameas0 */
2337+
*offset_est=0;/*treatasnot present */
23382338
}
23392339
}
23402340
else
@@ -2495,9 +2495,8 @@ limit_needed(Query *parse)
24952495
{
24962496
int64offset=DatumGetInt64(((Const*)node)->constvalue);
24972497

2498-
/* Executor would treat less-than-zero same as zero */
2499-
if (offset>0)
2500-
return true;/* OFFSET with a positive value */
2498+
if (offset!=0)
2499+
return true;/* OFFSET with a nonzero value */
25012500
}
25022501
}
25032502
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp