Skip to content

22008 — datetime_field_overflow

Source-backed reference for PostgreSQL SQLSTATE 22008.

22008

At a glance

22008 is datetime_field_overflow. Fixed date.c paths report out-of-range date values, date fields, and time fields; the exact message identifies which conversion or operation failed.

Field Value
SQLSTATE 22008
Condition datetime_field_overflow
Status active
Known present by 7.4
Locked snapshots 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3
Macros ERRCODE_DATETIME_FIELD_OVERFLOW, ERRCODE_DATETIME_VALUE_OUT_OF_RANGE
Aliases ERRCODE_DATETIME_VALUE_OUT_OF_RANGE

Meaning

22008 is datetime_field_overflow. The confirmed date.c paths cover date input and binary receive, make_date field/range validation, and make_time field validation. Date-to-timestamp and arithmetic paths can have their own range messages; inspect the complete primary before choosing a repair.

Messages

The confirmed guards raise ERROR with primary templates date out of range, date out of range: %d-%02d-%02d, and time field value out of range: %d:%02d:%02g. These cited groups have no separate DETAIL or HINT. This page is source-only; no natural runtime observation is claimed.

Diagnosis

Preserve the field values, target datetime type, and whether the operation parsed a date or performed arithmetic. Do not confuse this with 22007 format syntax.

Response

Correct the date fields or choose a representable finite range. If the complete message names a timestamp conversion or infinity arithmetic, change that operation explicitly. This is an ERROR: in an explicit transaction, roll back the transaction or roll back to a savepoint established before the failing conversion before continuing. Re-run only after the input or operation is fixed. No runtime case was run for this page.

Versions

The locked catalogue records this condition from 7.4 in the listed formal snapshots and 19beta3; fixed source coverage is PostgreSQL 18.6.

22000, 22001, 22003, 22004

Sources

See the fixed source links and scope limits in the structured evidence record.