2200S
Read PG 18 manual ↗invalid_xml_comment
- SQLSTATE
- 2200S
- Condition name
- invalid_xml_comment
- Class
- Data Exception
- Source macro
- ERRCODE_INVALID_XML_COMMENT
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
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.
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.
The locked catalogue records 2200S from 8.3.0 without proving an exact implementation introduction date.
Method: Use catalogue boundary.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·- src/backend/utils/adt/xml.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
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