22015 — interval_field_overflow
interval 输入字段超出可接受范围。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Data Exception
- condition name
- interval_field_overflow
- lang
- en
- sqlstate
- 22015
版本定义 PG 18
速览 {#at-a-glance}
interval 输入字段超出 interval 解码器接受的范围。PostgreSQL 18.6 将这一日期时间解析条件映射为 SQLSTATE 22015;后续 interval 构造或算术运算可能使用其他范围码。
含义 {#meaning}
固定的 interval_in 路径先解析输入,再按 typmod 范围解码 interval 字段;第一次解析返回格式错误时还会尝试 ISO 8601。解码返回 DTERR_FIELD_OVERFLOW 时,interval_in 将其改为 DTERR_INTERVAL_OVERFLOW;随后 DateTimeParseError 用 ERRCODE_INTERVAL_FIELD_OVERFLOW 把原始输入放进 primary。这是 interval 字段输入边界。itmin2interval 转换失败、typmod 调整和 interval 算术有独立 guard,可能报告 22008、22003 或其他条件,不会自动变成 22015。
诊断 {#diagnosis}
阅读完整 primary,确认输入字符串、interval 字段和声明的 typmod/范围。区分字段解码时溢出,还是后续构造、缩放或除 interval 时才失败。日期时间字段诊断属于相邻的日期时间错误码,interval 除以零因子属于 22012。不要用一般数值溢出修复替代字段范围问题。
处理 {#response}
修正报文指出的 interval 字段或输入表示,使其落在操作接受的范围内;如果边界来自 interval typmod,也要复核该约束。如果失败发生在后续算术中,应按它自己的 SQLSTATE 修复。普通错误上下文中该路径抛出 ERROR,显式事务需先 ROLLBACK 或 ROLLBACK TO SAVEPOINT 再重试;调用方提供 ErrorSaveContext 时,错误会被保存,调用返回 NULL/失败而不是抛出。
报文 {#messages}
- 普通上下文为
ERROR的 primary:interval field value out of range: "%s",其中%s是原始 interval 输入。引用分支没有固定 DETAIL 或 HINT。
版本 {#versions}
锁定目录从 7.4 起记录该条件;固定源码覆盖 PostgreSQL 18.6。源码确认的路径是 interval 输入解码,不声称所有 interval 算术溢出都使用 22015。
相关 {#related}
来源 {#sources}
src/backend/utils/adt/timestamp.c#L884-L967包含interval_in、typmod 范围选择、日期时间解码、DTERR_FIELD_OVERFLOW重映射和后续itmin2interval范围分支。src/backend/utils/adt/datetime.c#L4195-L4266把DTERR_INTERVAL_OVERFLOW映射为确切的22015primary,并说明errsave会填充ErrorSaveContext而不是抛错。
运行核验为 not_run;本页不宣称 interval 运行观察。结构化证据记录保留确切报文角色和源码边界。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed errcodes row and macro.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "22015 is interval_field_overflow in SQLSTATE Class 22."
}claims · interval-input-path
{
"claim_id": "interval-input-path",
"limits": "This is the interval input decoding path, not every interval arithmetic overflow.",
"method": "Read interval_in, the remap, and the DateTimeParseError switch.",
"position": 1,
"runtime": [],
"sources": [
"src.interval-input.18.6",
"src.datetime-errors.18.6"
],
"statement": "interval_in maps a datetime field-overflow decode result to DTERR_INTERVAL_OVERFLOW before DateTimeParseError reports the interval-field primary; later itmin2interval range failure is a separate 22008 branch."
}claims · soft-error-path
{
"claim_id": "soft-error-path",
"limits": "",
"method": "Read the ErrorSaveContext comment and errsave branch.",
"position": 2,
"runtime": [],
"sources": [
"src.datetime-errors.18.6"
],
"statement": "DateTimeParseError fills ErrorSaveContext through errsave instead of throwing when a soft error context is supplied; ordinary callers receive ERROR."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue presence and history boundaries.",
"position": 3,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 22015 from 7.4 without proving an exact implementation introduction date."
}messages · message.interval-field-overflow
{
"limits": "",
"message_id": "message.interval-field-overflow",
"path": "",
"position": 0,
"raw": {
"id": "message.interval-field-overflow",
"primary_template": "interval field value out of range: \"%s\"",
"severity_source": "ERROR (ordinary context; errsave soft path when escontext supplied)",
"sources": [
"src.datetime-errors.18.6"
],
"sqlstate": "22015"
},
"severity": "ERROR (ordinary context; errsave soft path when escontext supplied)",
"sources": [
"src.datetime-errors.18.6"
],
"templates": [
{
"kind": "primary",
"literal": "interval field value out of range: \" \"",
"position": 0,
"role": "",
"template": "interval field value out of range: \"%s\""
}
]
}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#L185"
}sources · src.interval-input.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/timestamp.c",
"position": 1,
"sha256": "2614ccd2182fa904b4cac9bef43039e90a1af578d2d1c6803d49a07420d168f2",
"source_id": "src.interval-input.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/timestamp.c#L884-967"
}sources · src.datetime-errors.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/datetime.c",
"position": 2,
"sha256": "709e05b536f611f7eeaaabb716501d59d4d1e87c53757e15240fe1fc4845459c",
"source_id": "src.datetime-errors.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/datetime.c#L4195-4266"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:7c9b397a8eae2359eda1701b3f2c9b44599e435cc802048255eb3999776740d9
正文语言: zh-Hans · english-manuals:7c9b397a8eae2359eda1701b3f2c9b44599e435cc802048255eb3999776740d9