2203C — sql_json_object_not_found
JSON 路径访问器要求对象却收到非对象项。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Data Exception
- condition name
- sql_json_object_not_found
- lang
- en
- sqlstate
- 2203C
版本定义 PG 18
2203C
速览 {#at-a-glance}
只接受对象的 JSON 路径访问器或 .keyvalue() 方法收到了非对象项。通配成员访问和对象键值展开使用这个结构检查条件。
报文 {#messages}
代表性首要报文如下:
| 触发条件 | 首要报文 |
| --- | --- |
| 通配成员访问器收到非对象 | jsonpath wildcard member accessor can only be applied to an object |
| .keyvalue() 收到非对象 | jsonpath item method .%s() can only be applied to an object |
含义 {#meaning}
通配成员分支要求 JSON 对象;当 jspIgnoreStructuralErrors 为 true 时,非对象结构不匹配可以被忽略,lax 模式也可能先自动解包数组。.keyvalue() 同样可能先自动解包数组,但随后直接要求对象容器;它的非对象检查通过 RETURN_ERROR 执行,抛错还是返回 jperError 由 jspThrowErrors 决定,而该上下文取决于调用方的 silent 或 ON ERROR 处理。lax 本身不会抑制 .keyvalue() 的直接检查。具名成员缺键属于 2203A,只接受数组的访问属于 22039。
诊断 {#diagnosis}
根据首要报文确认是通配访问器还是项方法,再检查当前项类型。区分对象接收项缺少具名键,与标量/数组接收项不能进行对象展开。将 lax 自动解包和结构错误处理纳入判断,不要直接把结果归为成员缺失。
处理 {#response}
让路径选出对象、规范化输入形状,或在调用只接受对象的操作前显式分支。对通配访问,只有当业务确实要丢弃非对象分支时才使用 lax 结构抑制;对 .keyvalue(),lax 只能先解包数组,剩余的非对象仍按直接的抛错/silent/ON ERROR 路径处理,不要假设 lax 会忽略它。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的动作。
版本 {#versions}
锁定目录从 12.0 起记录该条件;固定的只接受对象的访问器和 .keyvalue() 检查条件来自 PostgreSQL 18.6。本页未声称有自然运行观察。
相关 {#related}
来源 {#sources}
通配成员检查条件见 jsonpath_exec.c#L852-874,.keyvalue() 对象容器检查见 #L2806-2828。共享 strict/lax 与抛出/返回宏见 jsonpath_exec.c#L235-249。结构化证据记录绑定两条只接受对象的首要报文;本页未运行自然案例。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read fixed definition.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "2203C is sql_json_object_not_found in SQLSTATE Class 22."
}claims · resolved-path
{
"claim_id": "resolved-path",
"limits": "Source confirmation is not a natural runtime observation.",
"method": "Read the complete wildcard-member and keyvalue object-type guards, including array unwrap and structural-error handling.",
"position": 1,
"runtime": [],
"sources": [
"src.jsonpath.wildcard-member",
"src.jsonpath.keyvalue-object",
"src.jsonpath.context-flags",
"src.jsonpath.execute-context"
],
"statement": "The wildcard member branch requires an object, can ignore a non-object structural mismatch when jspIgnoreStructuralErrors is true, and may auto-unwrap an array in lax mode. .keyvalue() may auto-unwrap an array first, but its direct non-object guard uses RETURN_ERROR; throwing versus returning jperError follows jspThrowErrors and the caller's silent or ON ERROR context. Lax mode itself does not suppress that direct .keyvalue() guard."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue boundary.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 2203C from 12.0 without proving exact implementation introduction."
}messages · message.wildcard-member
{
"limits": "",
"message_id": "message.wildcard-member",
"path": "",
"position": 0,
"raw": {
"id": "message.wildcard-member",
"primary_template": "jsonpath wildcard member accessor can only be applied to an object",
"severity_source": "ERROR",
"sources": [
"src.jsonpath.wildcard-member"
],
"sqlstate": "2203C"
},
"severity": "ERROR",
"sources": [
"src.jsonpath.wildcard-member"
],
"templates": [
{
"kind": "primary",
"literal": "jsonpath wildcard member accessor can only be applied to an object",
"position": 0,
"role": "",
"template": "jsonpath wildcard member accessor can only be applied to an object"
}
]
}messages · message.keyvalue-object
{
"limits": "",
"message_id": "message.keyvalue-object",
"path": "",
"position": 1,
"raw": {
"id": "message.keyvalue-object",
"primary_template": "jsonpath item method .%s() can only be applied to an object",
"severity_source": "ERROR",
"sources": [
"src.jsonpath.keyvalue-object"
],
"sqlstate": "2203C"
},
"severity": "ERROR",
"sources": [
"src.jsonpath.keyvalue-object"
],
"templates": [
{
"kind": "primary",
"literal": "jsonpath item method . () can only be applied to an object",
"position": 0,
"role": "",
"template": "jsonpath item method .%s() can only be applied to an object"
}
]
}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#L227"
}sources · src.jsonpath.wildcard-member
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/jsonpath_exec.c",
"position": 1,
"sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
"source_id": "src.jsonpath.wildcard-member",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L852"
}sources · src.jsonpath.keyvalue-object
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/jsonpath_exec.c",
"position": 2,
"sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
"source_id": "src.jsonpath.keyvalue-object",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L2806"
}sources · src.jsonpath.context-flags
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/jsonpath_exec.c",
"position": 3,
"sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
"source_id": "src.jsonpath.context-flags",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L235"
}sources · src.jsonpath.execute-context
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/jsonpath_exec.c",
"position": 4,
"sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
"source_id": "src.jsonpath.execute-context",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L654"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:d0e22ace86901329b1c93975371e1d63d8e00d1733a348765351b8db9da50a24
正文语言: zh-Hans · english-manuals:d0e22ace86901329b1c93975371e1d63d8e00d1733a348765351b8db9da50a24