↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

2203B — sql_json_number_not_found

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.

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

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

Definition PG 18

2203B

At a glance {#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 {#messages}

The fixed unary branch reports:

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

Meaning {#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 {#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 {#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 {#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.

Related {#related}

22036, 22038, 22012

Sources {#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.

Compare versions

SQLSTATE evidence and recorded runtime versions

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"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:07e4828450f4ab833513d32a523e6497f00d4ded255acff7efb5a19f2b5b5b90

Text language: en · english-manuals:07e4828450f4ab833513d32a523e6497f00d4ded255acff7efb5a19f2b5b5b90