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

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

Wiki / SQLSTATE

2203B — sql_json_number_not_found

jsonpath 一元运算收到非数值的项。

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

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

aliases
未知
class name
Data Exception
condition name
sql_json_number_not_found
lang
en
sqlstate
2203B

版本定义 PG 18

2203B

速览 {#at-a-glance}

jsonpath 一元算术操作符要求数值操作数,却收到了其他类型的项。这是一元操作符边界,与数值转换方法分开。

报文 {#messages}

固定的一元分支报告:

operand of unary jsonpath operator %s is not a numeric value

含义 {#meaning}

executeUnaryArithmExpr 遍历操作数序列并接受其中每个数值标量项,对每项应用一元函数。只有同时满足 !found 和 !hasNext 时才会跳过非数值项;这表示终止的存在性求值且不收集结果。其他情况下都会进入 2203B 检查条件,包括普通结果收集在终止步骤遇到非数值项时。lax 模式下执行器可能先解包数组。.number() 或 .integer() 等数值项方法使用 22036。

诊断 {#diagnosis}

查看一元操作符名称和它之前的完整项序列。检查哪些项是数值、lax 解包是否改变了序列,以及调用方是在收集结果还是只在终止步骤做存在性判断。不要把它解释成数值越界或数值转换方法失败。

处理 {#response}

约束路径使其得到预期的数值序列,规范化每个 JSON 值,或改用接受实际类型的操作。把终止的存在性/不收集结果优化作为单独的已知行为记录;普通结果收集仍要求每个被处理项都是数值。如果 ERROR 发生在显式事务中,应先 ROLLBACK 或回滚到既有保存点再重试;自动提交可重试修正后的动作。

版本 {#versions}

锁定目录从 12.0 起记录该条件;固定的一元算术分支来自 PostgreSQL 18.6。本页未声称有自然运行观察。

相关 {#related}

22036、22038、22012

来源 {#sources}

完整的一元算术序列和非数值检查条件见 jsonpath_exec.c#L2158-2221。共享 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": "2203B is sql_json_number_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 executeUnaryArithmExpr loop and its terminal/continued-result guard.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.jsonpath.unary-arithmetic",
    "src.jsonpath.context-flags",
    "src.jsonpath.execute-context"
  ],
  "statement": "executeUnaryArithmExpr walks the operand sequence and accepts every numeric scalar item, applying the unary function to each. A nonnumeric item is skipped only when both !found and !hasNext hold, meaning terminal existence-style evaluation that is not collecting results; ordinary result collection still reaches 2203B for a nonnumeric item even at a terminal step. Lax mode may unwrap an array. This is distinct from 22036 numeric item-method conversion."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 2203B from 12.0 without proving exact implementation introduction."
}
messages · message.unary-numeric
{
  "limits": "",
  "message_id": "message.unary-numeric",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.unary-numeric",
    "primary_template": "operand of unary jsonpath operator %s is not a numeric value",
    "severity_source": "ERROR",
    "sources": [
      "src.jsonpath.unary-arithmetic"
    ],
    "sqlstate": "2203B"
  },
  "severity": "ERROR",
  "sources": [
    "src.jsonpath.unary-arithmetic"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "operand of unary jsonpath operator is not a numeric value",
      "position": 0,
      "role": "",
      "template": "operand of unary jsonpath operator %s is not a numeric value"
    }
  ]
}
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#L226"
}
sources · src.jsonpath.unary-arithmetic
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/jsonpath_exec.c",
  "position": 1,
  "sha256": "678cb8947f0b5e6ad14524f1863987ab99641cfb5f81121fc5c5006af0319d02",
  "source_id": "src.jsonpath.unary-arithmetic",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/jsonpath_exec.c#L2158"
}
sources · src.jsonpath.context-flags
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/jsonpath_exec.c",
  "position": 2,
  "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": 3,
  "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"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:07e4828450f4ab833513d32a523e6497f00d4ded255acff7efb5a19f2b5b5b90

正文语言: zh-Hans · english-manuals:07e4828450f4ab833513d32a523e6497f00d4ded255acff7efb5a19f2b5b5b90