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_comment

SQLSTATE
2200S
Condition name
invalid_xml_comment
Class
Data Exception
Source macro
ERRCODE_INVALID_XML_COMMENT
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>2200S</h1>

At a glance

An XML comment is invalid. PostgreSQL 18.6’s xmlcomment path reports invalid XML comment when the comment text contains the forbidden -- sequence or ends in -; this is comment-specific XML syntax rather than a general document failure.

Meaning

This member is specific to XML comment syntax, rather than to all XML document failures. Under USE_LIBXML, xmlcomment scans the input before constructing ``; a double hyphen anywhere or a trailing hyphen is rejected.

Messages

The guard raises ERROR with primary invalid XML comment. The cited branch has no separate DETAIL or HINT. Without USE_LIBXML, the function follows the separate XML-support path (0A000), so source presence does not by itself prove availability in every server build.

Diagnosis

Inspect the comment text and the exact XML context named by the message. XML comments cannot contain the forbidden double-hyphen form or end with a hyphen; repair that comment while preserving surrounding markup. If the parser instead identifies a processing instruction or non-document content, follow 2200T or 2200L/N as reported.

Response

Repair the comment text while preserving surrounding XML, following the comment-specific message rather than applying a general document workaround.

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#L490-523. The structured evidence record retains the complete comment guard, message, and scope boundaries. The offending comment is runtime input and the function is compiled under USE_LIBXML; no natural XML runtime was run here.

Source evidence

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

2200S is invalid_xml_comment in SQLSTATE Class 22.

Method: Read fixed definition.

src.errcodes.18.6

xmlcomment rejects a comment containing -- or ending in - and emits 2200S with invalid XML comment.

Method: Read the complete comment validation loop.

Limits: The branch is guarded by USE_LIBXML; without XML support the function follows the separate 0A000 path.

src.path.xml-comment

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

Method: Use catalogue boundary.

src.errcodes.18.6

Message templates

ERROR · message.comment

Primary

invalid XML comment

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