选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class 22 数据异常

2203B sql_json_number_not_found

ERROR 源码确认 参考 未实测

类别
Class 22 数据异常
严重等级
ERROR
条件名
sql_json_number_not_found
宏名称
ERRCODE_SQL_JSON_NUMBER_NOT_FOUND
启用版本
12
状态
活跃

版本覆盖

速览

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

报文

固定的一元分支报告:

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

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

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

来源:src/backend/utils/adt/jsonpath_exec.c @ REL_18_6

含义

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

诊断

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

处理

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

版本

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

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • 2203B is sql_json_number_not_found in SQLSTATE Class 22.

    核实方式Read fixed definition.

    来源src/backend/utils/errcodes.txt

  • 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.

    核实方式Read the complete executeUnaryArithmExpr loop and its terminal/continued-result guard.

    不覆盖Source confirmation is not a natural runtime observation.

    来源src/backend/utils/adt/jsonpath_exec.c · src/backend/utils/adt/jsonpath_exec.c · src/backend/utils/adt/jsonpath_exec.c

  • The locked catalogue records 2203B from 12.0 without proving exact implementation introduction.

    核实方式Use catalogue boundary.

    来源src/backend/utils/errcodes.txt

同类错误代码

Class 22 数据异常 下的其他成员。