PostgreSQL error code
PostgreSQL error 22023
22023 is the SQLSTATE PostgreSQL reports for invalid parameter value, in class 22, Data Exception.
| SQLSTATE | 22023 |
|---|---|
| Condition name | invalid_parameter_value |
| Class | 22 — Data Exception |
Reproduce it, then fix it
A step of zero never reaches the end of the series, so PostgreSQL rejects it. The same code covers other out-of-range arguments to built-in functions. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
SELECT day::date FROM generate_series(date '2024-01-01', date '2024-01-31', interval '0 days') AS day;
SELECT day::date FROM generate_series(date '2024-01-01', date '2024-01-31', interval '7 days') AS day;