Skip to content

Make generate_series return an empty set with invalid ranges #19998

@nuno-faria

Description

@nuno-faria

Describe the bug

The generate_series scalar function returns an empty list when the range is invalid, while the generate_series table function returns an error.

Other systems, like Postgres, DuckDB, and SQLite, return an empty set.

To Reproduce

> select generate_series(0, -1);
+-------------------------------------+
| generate_series(Int64(0),Int64(-1)) |
+-------------------------------------+
| []                                  |
+-------------------------------------+

> select * from generate_series(0, -1);
Error during planning: Start is bigger than end, but increment is positive: Cannot generate infinite series

Expected behavior

Return an empty set when the range is invalid.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions