Skip to content

2200S — invalid_xml_comment

Source-backed reference for PostgreSQL SQLSTATE 2200S.

2200S

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.

Field Value
SQLSTATE 2200S
Condition invalid_xml_comment
Status active
Known present by 8.3.0
Locked snapshots 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3
Macros ERRCODE_INVALID_XML_COMMENT
Aliases

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.

2200L, 2200T

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.