Skip to main content
Scalar function
Returns NULL for a typed NULL endpoint or a supplied typed NULL step. Omitting step uses the default for the sequence’s direction. An untyped NULL step is rejected; cast NULL to the required numeric or interval type if needed.

Syntax

Scalar

Arguments

Returns

  • Type: ARRAY<BIGINT>, ARRAY<DATE> or ARRAY<TIMESTAMP>
  • Possible values: Values from start toward stop, including stop when reached exactly.
  • NULL behavior: Returns NULL for a typed NULL endpoint or a supplied typed NULL step. Omitting step uses the default for the sequence’s direction. An untyped NULL step is rejected; cast NULL to the required numeric or interval type if needed.
  • Shape: One element per increment that remains within the inclusive endpoint.
  • Ordering: Increment direction.

Properties

Usage notes

  • Bounds are converted to a compatible integer or date/time type. Integer sequences return BIGINT elements even when query tools report a narrower ARRAY element type.
  • Temporal steps add calendar months first, adjusting an invalid day to the last day of the month, then days, then the time component for TIMESTAMP. Fractions below a microsecond are discarded. TIMESTAMP values use microsecond precision with no time zone or UTC.

Examples

Typical behavior

Generate a descending sequence

Limitations

  • Zero step or a step directed away from stop raises an error.
  • Very large sequences require large allocations; numeric endpoint subtraction is unchecked.
  • DATE steps ignore the interval nanosecond component. A sub-day-only DATE step or a mixed-sign calendar step that does not advance toward stop can fail to terminate. Use nonzero month/day DATE increments and steps that consistently advance toward stop.
  • The source checks interval direction lexicographically by first nonzero months, then days, then nanoseconds. That direction check does not prove a mixed-component step actually advances.
Last modified on October 15, 2026