Generate a set of integer, numeric, or timestamp values as a virtual table row source.
Generates a series of values from start to end with an optional step, available in PostgreSQL and SQLite (3.31.0+). Essential for generating date sequences, test data, and calendar tables without creating physical tables.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✗ Not Supported | — | Not supported. Workaround: recursive CTE (limited to @@cte_max_recursion_depth, default 1000). |
| PostgreSQL | ✓ Supported | 8.0 | generate_series(start, stop[, step]) for integers/bigints/numerics. Timestamp support added in 8.4. Negative step works. Returns empty set if start > stop (with positive step). |
| SQL Server | ✓ Supported | 2022 | GENERATE_SERIES(start, stop[, step]) added in SQL Server 2022. Requires database compatibility level 160. Supports int, bigint, decimal, numeric. No timestamp/date support. |
| Oracle | ✗ Not Supported | — | Not supported. Workaround: CONNECT BY LEVEL for integers; recursive CTE for other types. |
| SQLite | ✓ Supported | 3.31.0 | Built-in table-valued function since 3.31.0, but may require explicit loading in some environments and is not enabled by default. |
PostgreSQL's timestamp/interval support is the killer feature — filling a date spine for reporting, finding calendar gaps, or generating billing periods is trivial. SQL Server 2022 added a limited version (integers/decimals only, requires compatibility level 160).
Not supported. Workaround: recursive CTE (limited to @@cte_max_recursion_depth, default 1000).
generate_series(start, stop[, step]) for integers/bigints/numerics. Timestamp support added in 8.4. Negative step works. Returns empty set if start > stop (with positive step).
GENERATE_SERIES(start, stop[, step]) added in SQL Server 2022. Requires database compatibility level 160. Supports int, bigint, decimal, numeric. No timestamp/date support.
Not supported. Workaround: CONNECT BY LEVEL for integers; recursive CTE for other types.
Built-in table-valued function since 3.31.0, but may require explicit loading in some environments and is not enabled by default.