22008: datetime_field_overflow
PostgreSQLWhat does it mean?
While computing or parsing a date/time value, one of the fields fell outside its valid range. For example, an impossible component such as month 13 or day 32, or a result beyond the supported time range, was produced.
Why does it happen?
An invalid date input (e.g. '2026-02-30'), an out-of-range component, or an INTERVAL addition exceeding the supported date range. Parsing with the wrong format/locale or inserting unvalidated user input is the typical cause.
How to fix it
Validate date inputs in the application before inserting and send them in the correct format (preferably ISO 8601: YYYY-MM-DD). When parsing with TO_DATE/TO_TIMESTAMP, match the format mask to the input. Keep arithmetic results within the supported date range; run suspicious values through bounds checks.