Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Table functions

Registered variants include:

generate_series(int4, int4 [, int4])
generate_series(int8, int8 [, int8])
generate_series(date, date [, interval])

Each variant returns a column named generate_series and rejects a zero step. The series is lazy: LIMIT stops value production.

The simple single-column form in the SELECT list is also supported:

SELECT generate_series(1, 3);

To query a table directly, use TABLE name, equivalent to SELECT * FROM name.

For the temporal variant, months are applied first and the day is clamped to the last day of the resulting month; days are applied afterwards. For example, date '2024-01-30' with interval '1 month' produces 2024-02-29. The current implementation requires intervals used with date to represent whole days; fractional hours, minutes, and seconds are not part of this overload yet.

SELECT * FROM generate_series(date '2024-01-30', date '2024-05-01', interval '1 month');