PostgreSQL 8.0.1 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 9. Functions and Operators | Fast Forward | Next |
9.18. Set Returning Functions
This section describes functions that possibly return more than one row. Currently the only functions in this class are series generating functions, as detailed in Table 9-38.
Table 9-38. Series Generating Functions
Function | Argument Type | Return Type | Description |
---|---|---|---|
generate_series (start, stop) | int or bigint | setof int or setof bigint (same as argument type) | Generate a series of values, from start to stop with a step size of one. |
generate_series (start, stop, step) | int or bigint | setof int or setof bigint (same as argument type) | Generate a series of values, from start to stop with a step size of step. |
When step is positive, zero rows are returned if start is greater than stop. Conversely, when step is negative, zero rows are returned if start is less than stop. Zero rows are also returned for NULL inputs. It is an error for step to be zero. Some examples follow: