select open change scope Open full search

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

SQLSTATE / CLASS 22 · DATA EXCEPTION

invalid_xml_processing_instruction

SQLSTATE
2200T
Condition name
invalid_xml_processing_instruction
Class
Data Exception
Source macro
ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION
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>2200T</h1>

At a glance

An XML processing instruction violates its XML syntax. PostgreSQL 18.6’s xmlpi path rejects a target whose name is case-insensitively xml, or a non-NULL body containing ?>; both guards report invalid XML processing instruction with a branch-specific DETAIL.

Meaning

This member is specific to XML processing-instruction syntax, including its target name and body. xmlpi checks the target with case-insensitive comparison, so xml, XML, and mixed-case forms hit the same target guard. Only after that syntax check does it apply the SQL NULL rule: a NULL body returns NULL for a valid target. A non-NULL body containing ?> hits the body guard.

Messages

The target guard raises ERROR with primary invalid XML processing instruction and DETAIL XML processing instruction target name cannot be "%s".. The body guard uses the same primary and DETAIL XML processing instruction cannot contain "?>".. The cited branches have no separate HINT. %s is the runtime target name; a NULL body after a valid target is not a 2200T error.

Diagnosis

Use the full message and detail to identify whether the target name or the instruction body is wrong. Check the target-name rule and remove the terminating ?> sequence from the body while keeping the surrounding XML structure valid. Do not repair a comment or a general document error using this member’s rules.

Response

Repair the target name or instruction body named by the detail, preserving valid XML structure and removing the forbidden processing-instruction form.

When this branch raises ERROR, an explicit transaction must first be recovered with ROLLBACK or ROLLBACK TO SAVEPOINT for a savepoint established before the statement; in autocommit, retry only the corrected action after the failed statement completes. See the transaction and retry guide for this boundary rule.

Versions

The locked catalogue records this condition from 8.3.0; fixed source coverage is PostgreSQL 18.6.

Sources

Fixed source: src/backend/utils/adt/xml.c#L1010-1055. The structured evidence record retains both guards, message/detail variants, NULL ordering, and scope boundaries. Target names and instruction content are runtime values; no natural XML 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.

2200T is invalid_xml_processing_instruction in SQLSTATE Class 22.

Method: Read fixed definition.

src.errcodes.18.6

xmlpi rejects the target name xml and reports 2200T with a target-specific DETAIL.

Method: Read the target-name branch and its detail.

Limits: The NULL argument check follows the target check and returns NULL after a valid target.

src.path.xmlpi

xmlpi also rejects a body containing ?> and reports 2200T with a body-specific DETAIL.

Method: Read the body validation branch.

Limits: Do not apply comment or document repairs to this processing-instruction path.

src.path.xmlpi

The locked catalogue records 2200T from 8.3.0 without proving an exact implementation introduction date.

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.target

Primary

invalid XML processing instruction

Detail

XML processing instruction target name cannot be "%s".
ERROR · message.body

Primary

invalid XML processing instruction

Detail

XML processing instruction cannot contain "?>".

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:21c15ecb73397c8a60e10bda14e… · English manual source