↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQLSTATE

22008 — datetime_field_overflow

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

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

aliases
Unknown
class name
Data Exception
condition name
datetime_field_overflow
lang
en
sqlstate
22008

Definition PG 18

22008

At a glance {#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.

Meaning {#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 {#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 {#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 {#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 {#versions}

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

Related {#related}

22000, 22001, 22003, 22004

Sources {#sources}

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

Compare versions

SQLSTATE evidence and recorded runtime versions

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read fixed definition.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "22008 is datetime_field_overflow in SQLSTATE Class 22."
}
claims · mechanism.date-range
{
  "claim_id": "mechanism.date-range",
  "limits": "This page does not claim every timestamp or interval overflow uses the same message.",
  "method": "Read date.c range guards.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.date-recv",
    "src.path.date-field"
  ],
  "statement": "The date input/binary receive and field validation paths use 22008 for an unrepresentable date or field; the primary wording identifies whether the failure is a field or range check."
}
claims · mechanism.time-field
{
  "claim_id": "mechanism.time-field",
  "limits": "Inspect the named target type and operation before choosing a repair.",
  "method": "Read the time-field guard.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.path.time-field"
  ],
  "statement": "The make_time path uses the same condition for an out-of-range time field."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 22008 from 7.4 without proving an exact implementation introduction date."
}
messages · message.date-range
{
  "limits": "",
  "message_id": "message.date-range",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.date-range",
    "primary_template": "date out of range",
    "severity_source": "ERROR",
    "sources": [
      "src.path.date-recv"
    ],
    "sqlstate": "22008"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.date-recv"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "date out of range",
      "position": 0,
      "role": "",
      "template": "date out of range"
    }
  ]
}
messages · message.date-field
{
  "limits": "",
  "message_id": "message.date-field",
  "path": "",
  "position": 1,
  "raw": {
    "id": "message.date-field",
    "primary_template": "date field value out of range: %d-%02d-%02d",
    "severity_source": "ERROR",
    "sources": [
      "src.path.date-field"
    ],
    "sqlstate": "22008"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.date-field"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "date field value out of range: - -",
      "position": 0,
      "role": "",
      "template": "date field value out of range: %d-%02d-%02d"
    }
  ]
}
messages · message.time-field
{
  "limits": "",
  "message_id": "message.time-field",
  "path": "",
  "position": 2,
  "raw": {
    "id": "message.time-field",
    "primary_template": "time field value out of range: %d:%02d:%02g",
    "severity_source": "ERROR",
    "sources": [
      "src.path.time-field"
    ],
    "sqlstate": "22008"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.time-field"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "time field value out of range: : :",
      "position": 0,
      "role": "",
      "template": "time field value out of range: %d:%02d:%02g"
    }
  ]
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L166"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 1,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}
sources · src.path.date-recv
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/date.c",
  "position": 2,
  "sha256": "4834c868f3461822eb0de972fe35b04f9fb9ba75cf2fa9794a67259536f35773",
  "source_id": "src.path.date-recv",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/date.c#L217-L223"
}
sources · src.path.date-field
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/date.c",
  "position": 3,
  "sha256": "4834c868f3461822eb0de972fe35b04f9fb9ba75cf2fa9794a67259536f35773",
  "source_id": "src.path.date-field",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/date.c#L271-L293"
}
sources · src.path.time-field
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/date.c",
  "position": 4,
  "sha256": "4834c868f3461822eb0de972fe35b04f9fb9ba75cf2fa9794a67259536f35773",
  "source_id": "src.path.time-field",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/date.c#L1649-L1654"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:9ff3990b3af217485a8bf6256ab3781a90062b791e5d7f8334f9dddd90cdef2c

Text language: en · english-manuals:9ff3990b3af217485a8bf6256ab3781a90062b791e5d7f8334f9dddd90cdef2c