Skip to content

Commit

Permalink
Correctly handle large values earlier in limit percent
Browse files Browse the repository at this point in the history
  • Loading branch information
Mytherin committed Feb 28, 2024
1 parent e663f20 commit 598e092
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/planner/binder/query_node/bind_select_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ BoundLimitNode Binder::BindLimitValue(OrderBinder &order_binder, unique_ptr<Pars
} else {
percentage_val = val.GetValue<double>();
}
if (percentage_val < 0) {
throw BinderException(expr->query_location, "LIMIT cannot be negative");
if (Value::IsNan(percentage_val) || percentage_val < 0 || percentage_val > 100) {
throw OutOfRangeException("Limit percent out of range, should be between 0% and 100%");
}
return BoundLimitNode::ConstantPercentage(percentage_val);
} else {
Expand Down

0 comments on commit 598e092

Please sign in to comment.