↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / SQLSTATE

22008 — datetime_field_overflow

日期或时间字段取值越界。

英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

aliases
未知
class name
Data Exception
condition name
datetime_field_overflow
lang
en
sqlstate
22008

版本定义 PG 18

22008

速览 {#at-a-glance}

固定 date.c 路径报告日期值、日期字段和时间字段越界;具体 primary 会说明失败的转换或操作。

含义 {#meaning}

已确认的 date.c 路径覆盖 date 输入/二进制接收、make_date 字段和范围校验,以及 make_time 字段校验。date 到 timestamp 的转换和算术路径可能使用各自的范围报文;应先看完整 primary 再决定修复。

报文 {#messages}

已确认的 guard 以 ERROR 严重性报告 primary 模板 date out of range、date out of range: %d-%02d-%02d 和 time field value out of range: %d:%02d:%02g。引用的源码组没有独立 DETAIL 或 HINT。本页只有源码证据,没有自然运行观察。

诊断 {#diagnosis}

保留日期字段、目标 datetime 类型,以及操作是否解析日期文本或执行算术;若涉及 infinity,再记录是否执行了无限值运算。不要与 22007 的格式错误混淆。

处置 {#response}

修正日期字段或选择可表示的有限范围;若完整消息指向 timestamp 转换或 infinity 运算,应明确修改该运算。这是 ERROR:显式事务中要回滚整个事务,或回滚到失败转换前建立的保存点后再继续。本页没有运行案例。

版本 {#versions}

锁定目录从 7.4 记录该条件,并在列出的正式快照及 19beta3 中出现;固定源码覆盖为 PostgreSQL 18.6。

相关条件 {#related}

22000, 22001, 22003, 22004

来源 {#sources}

详见结构化的证据记录,其中列出固定源码链接与范围限制。

比较版本

SQLSTATE 证据与已记录的运行版本

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"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:9ff3990b3af217485a8bf6256ab3781a90062b791e5d7f8334f9dddd90cdef2c

正文语言: zh-Hans · english-manuals:9ff3990b3af217485a8bf6256ab3781a90062b791e5d7f8334f9dddd90cdef2c