* Compute the maximum number of tuples needed to satisfy this Limit node. * Return a negative value if there is not a determinable limit. */
| 453 | * Return a negative value if there is not a determinable limit. |
| 454 | */ |
| 455 | static int64 |
| 456 | compute_tuples_needed(LimitState *node) |
| 457 | { |
| 458 | if ((node->noCount) || (node->limitOption == LIMIT_OPTION_WITH_TIES)) |
| 459 | return -1; |
| 460 | /* Note: if this overflows, we'll return a negative value, which is OK */ |
| 461 | return node->count + node->offset; |
| 462 | } |
| 463 | |
| 464 | /* ---------------------------------------------------------------- |
| 465 | * ExecInitLimit |