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_object_not_found

SQLSTATE
2203C
Condition name
sql_json_object_not_found
Class
Data Exception
Source macro
ERRCODE_SQL_JSON_OBJECT_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>2203C</h1>

At a glance

An object-only JSON path accessor or .keyvalue() method received a non-object item. Wildcard member access and object key/value expansion use this structural guard.

Messages

Representative primary texts are:

Guard Primary
Wildcard member accessor receives a non-object jsonpath wildcard member accessor can only be applied to an object
.keyvalue() receives a non-object jsonpath item method .%s() can only be applied to an object

Meaning

The wildcard member branch accepts a JSON object; its non-object structural mismatch can be ignored when jspIgnoreStructuralErrors is true, and an array may be auto-unwrapped in lax mode. .keyvalue() may likewise auto-unwrap an array before it requires an object container, but its direct non-object guard uses RETURN_ERROR: throwing versus returning jperError follows jspThrowErrors, as selected by the caller's silent or ON ERROR handling. Lax mode itself does not suppress this direct .keyvalue() guard. Named member access with a missing key is 2203A, while array-only access is 22039.

Diagnosis

Use the primary to identify the wildcard accessor or item method, then inspect the current item type. Distinguish an object receiver that lacks a named key from a scalar/array receiver that cannot support object expansion. Check lax auto-unwrap and structural-error handling before treating the result as a missing item.

Response

Select an object, normalize the input shape, or branch before applying the object-only operation. For wildcard access, use lax structural suppression only when dropping a non-object branch is intended. For .keyvalue(), lax can only unwrap an array first; a remaining non-object follows the direct throw/silent/ON ERROR path, so do not assume lax suppression will ignore it. 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 object-only accessor and .keyvalue() guards are PostgreSQL 18.6. No natural runtime observation is claimed for this page.

Sources

The wildcard member guard is jsonpath_exec.c#L852-874, and .keyvalue() checks its object container at #L2806-2828. The shared strict/lax and throw-return macros are jsonpath_exec.c#L235-249. The structured evidence record binds both object-only primaries; 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.

2203C is sql_json_object_not_found in SQLSTATE Class 22.

Method: Read fixed definition.

src.errcodes.18.6

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.

Method: Read the complete wildcard-member and keyvalue object-type guards, including array unwrap and structural-error handling.

Limits: Source confirmation is not a natural runtime observation.

src.jsonpath.wildcard-member src.jsonpath.keyvalue-object src.jsonpath.context-flags src.jsonpath.execute-context

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

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.wildcard-member

Primary

jsonpath wildcard member accessor can only be applied to an object
ERROR · message.keyvalue-object

Primary

jsonpath item method .%s() can only be applied to an object

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:a8876898d68d3c280f64096d93e… · English manual source