2201X — invalid_row_count_in_result_offset_clause
OFFSET 行数无效,不能为负。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Data Exception
- condition name
- invalid_row_count_in_result_offset_clause
- lang
- en
- sqlstate
- 2201X
版本定义 PG 18
2201X
速览 {#at-a-glance}
OFFSET 表达式求值后为负数。固定执行器路径报告 OFFSET must not be negative。
含义 {#meaning}
LIMIT 节点重算时,NULL OFFSET 被解释为零(无偏移),零值合法,只有求得负值才进入 2201X。这是 2201W 的 OFFSET 专属姊妹码;LIMIT 或 FETCH 行数错误应按自己的 SQLSTATE 诊断。
诊断 {#diagnosis}
在参数替换和类型解析后检查 OFFSET 的实际值。区分 NULL/无偏移、零值和负值,不要把 LIMIT 或 FETCH 行数失败改称 2201X。
处理 {#response}
提供非负 OFFSET;若目标是无偏移,也可使用 NULL。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的语句。
版本 {#versions}
锁定目录从 8.4.0 起记录该条件;本页固定源码路径为 PostgreSQL 18.6。未声称本页有自然运行观察。
相关 {#related}
来源 {#sources}
执行器将 NULL 转为零并检查负值的守卫在 src/backend/executor/nodeLimit.c#L356-375。结构化证据记录保留确切首要模板和源码边界;本页未运行自然案例。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed errcodes row and macro.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "2201X is invalid_row_count_in_result_offset_clause in SQLSTATE Class 22"
}claims · resolved-path
{
"claim_id": "resolved-path",
"limits": "Source confirmation is not a natural runtime observation.",
"method": "Read complete source contexts for the representative guards.",
"position": 1,
"runtime": [],
"sources": [
"src.nodeLimit.offset"
],
"statement": "Fixed PostgreSQL 18.6 executor recomputation maps NULL OFFSET to zero and emits 2201X only for a negative evaluated offset."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue presence and history boundaries.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 2201X from 8.4.0 without proving an exact implementation introduction date."
}messages · message.offset-negative
{
"limits": "",
"message_id": "message.offset-negative",
"path": "",
"position": 0,
"raw": {
"id": "message.offset-negative",
"primary_template": "OFFSET must not be negative",
"severity_source": "ERROR",
"sources": [
"src.nodeLimit.offset"
],
"sqlstate": "2201X"
},
"severity": "ERROR",
"sources": [
"src.nodeLimit.offset"
],
"templates": [
{
"kind": "primary",
"literal": "OFFSET must not be negative",
"position": 0,
"role": "",
"template": "OFFSET must not be negative"
}
]
}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#L189"
}sources · src.nodeLimit.offset
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/executor/nodeLimit.c",
"position": 1,
"sha256": "f4c202d7182d66c6bef222fa50439831691dd99bfa5fd6b4de7f9142635dc305",
"source_id": "src.nodeLimit.offset",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/executor/nodeLimit.c#L356"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:a9a202940b4444e90645d6e2785180ffe3ab0a7284793473e2d8009cad2c989d
正文语言: zh-Hans · english-manuals:a9a202940b4444e90645d6e2785180ffe3ab0a7284793473e2d8009cad2c989d