select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 22 · DATA EXCEPTION

sql_json_number_not_found

SQLSTATE
2203B
Condition name
sql_json_number_not_found
Class
Data Exception
Source macro
ERRCODE_SQL_JSON_NUMBER_NOT_FOUND
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>2203B</h1>

At a glance

A unary jsonpath arithmetic operator needs a numeric operand but receives another item type. This is the unary-operator boundary, separate from numeric conversion methods.

Messages

The fixed unary branch reports:

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

Meaning

executeUnaryArithmExpr walks the operand sequence and accepts every numeric scalar item, applying the unary function to each. A non-numeric item is skipped only when both !found and !hasNext hold: that is a terminal existence-style evaluation that is not collecting results. Otherwise the 2203B guard is reached, including ordinary result collection at a terminal step. The evaluator may unwrap an array in lax mode. Numeric item methods such as .number() or .integer() use 22036 instead.

Diagnosis

Read the operator name and the full item sequence immediately before the unary operator. Check which items are numeric, whether lax unwrapping changed the sequence, and whether the caller is collecting results or only testing existence at a terminal step. Do not interpret this as an out-of-range numeric value or as a failed numeric conversion method.

Response

Constrain the path to the intended numeric sequence, normalize each JSON value, or choose an operation that accepts the actual type. Treat the terminal existence/no-collection optimization as a separate documented behavior; ordinary result collection still requires every processed item to be numeric. If an ERROR occurred in an explicit transaction, roll back or roll back to the existing savepoint before retrying; autocommit can retry the corrected action.

Versions

The locked catalogue records this condition from 12.0; the fixed unary arithmetic branch is PostgreSQL 18.6. No natural runtime observation is claimed for this page.

Sources

The complete unary arithmetic sequence and non-numeric guard are jsonpath_exec.c#L2158-2221. The shared strict/lax and throw-return macros are jsonpath_exec.c#L235-249. The structured evidence record binds the operator primary and terminal-path boundary; no natural runtime was run.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

2203B is sql_json_number_not_found in SQLSTATE Class 22.

Method: Read fixed definition.

src.errcodes.18.6

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.

Method: Read the complete executeUnaryArithmExpr loop and its terminal/continued-result guard.

Limits: Source confirmation is not a natural runtime observation.

src.jsonpath.unary-arithmetic src.jsonpath.context-flags src.jsonpath.execute-context

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

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.unary-numeric

Primary

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

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Version history 1
  1. PG 11 → 12added

Definition snapshot: english-manuals:f594f298c9ddeadf719c377c16a… · English manual source