↑↓ 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

Reading PG 18current·documented in 20 of 22 versions, 8.3 to 20

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.

Source: src/backend/utils/errcodes.txt

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.

Source: src/backend/utils/adt/xml.c

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.

Source: src/backend/utils/adt/xml.c

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

Method: Use catalogue boundary.

Source: src/backend/utils/errcodes.txt

Message templates

ERROR · message.target

Primary

invalid XML processing instruction

Detail

XML processing instruction target name cannot be "%s".

Source: src/backend/utils/adt/xml.c

ERROR · message.body

Primary

invalid XML processing instruction

Detail

XML processing instruction cannot contain "?>".

Source: src/backend/utils/adt/xml.c

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. 8.2 → 8.3 added

Definition snapshot: english-manuals:442eafe8e6a84df21d47b90e60c… · English manual source