## 9.25. Set Returning Functions

[]()

 This section describes functions that possibly return more than one row. The most widely used functions in this class are series generating functions, as detailed in [Table 9.63](functions-srf.html#FUNCTIONS-SRF-SERIES) and [Table 9.64](functions-srf.html#FUNCTIONS-SRF-SUBSCRIPTS). Other, more specialized set-returning functions are described elsewhere in this manual. See [Section 7.2.1.4](queries-table-expressions.html#QUERIES-TABLEFUNCTIONS) for ways to combine multiple set-returning functions.

**Table 9.63. Series Generating Functions**

|                                                                                                                                                                                                                   Function<br/><br/> Description                                                                                                                                                                                                                  |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|[]() `generate_series` ( *`start`* `integer`, *`stop`* `integer` [, *`step`* `integer` ] ) → `setof integer`<br/><br/>`generate_series` ( *`start`* `bigint`, *`stop`* `bigint` [, *`step`* `bigint` ] ) → `setof bigint`<br/><br/>`generate_series` ( *`start`* `numeric`, *`stop`* `numeric` [, *`step`* `numeric` ] ) → `setof numeric`<br/><br/> Generates a series of values from *`start`* to *`stop`*, with a step size of *`step`*. *`step`* defaults to 1.|
|                                           `generate_series` ( *`start`* `timestamp`, *`stop`* `timestamp`, *`step`* `interval` ) → `setof timestamp`<br/><br/>`generate_series` ( *`start`* `timestamp with time zone`, *`stop`* `timestamp with time zone`, *`step`* `interval` ) → `setof timestamp with time zone`<br/><br/> Generates 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 if any input is `NULL`. It is an error for *`step`* to be zero. Some examples follow:

```
SELECT * FROM generate_series(2,4);
 generate_series
