2200S — invalid_xml_comment
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.
English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- aliases
- Unknown
- class name
- Data Exception
- condition name
- invalid_xml_comment
- lang
- en
- sqlstate
- 2200S
Definition PG 18
2200S
At a glance {#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 {#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 {#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 {#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 {#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 {#versions}
The locked catalogue records this condition from 8.3.0; fixed source coverage is PostgreSQL 18.6.
Related {#related}
Sources {#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.
Compare versions
SQLSTATE evidence and recorded runtime versions
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read fixed definition.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "2200S is invalid_xml_comment in SQLSTATE Class 22."
}claims · mechanism.comment
{
"claim_id": "mechanism.comment",
"limits": "The branch is guarded by USE_LIBXML; without XML support the function follows the separate 0A000 path.",
"method": "Read the complete comment validation loop.",
"position": 1,
"runtime": [],
"sources": [
"src.path.xml-comment"
],
"statement": "xmlcomment rejects a comment containing -- or ending in - and emits 2200S with invalid XML comment."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue boundary.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 2200S from 8.3.0 without proving an exact implementation introduction date."
}messages · message.comment
{
"limits": "",
"message_id": "message.comment",
"path": "",
"position": 0,
"raw": {
"id": "message.comment",
"primary_template": "invalid XML comment",
"severity_source": "ERROR",
"sources": [
"src.path.xml-comment"
],
"sqlstate": "2200S"
},
"severity": "ERROR",
"sources": [
"src.path.xml-comment"
],
"templates": [
{
"kind": "primary",
"literal": "invalid XML comment",
"position": 0,
"role": "",
"template": "invalid XML comment"
}
]
}sources · src.errcodes.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L213"
}sources · src.calls.REL_18_6
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "raw/calls/REL_18_6.jsonl",
"position": 1,
"sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
"source_id": "src.calls.REL_18_6",
"tag": "",
"url": ""
}sources · src.path.xml-comment
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/xml.c",
"position": 2,
"sha256": "f1c70b5ee5ee9a20a41d9b2c27bc7a8a50dbd47d9489ba462a4a678f7f55f14d",
"source_id": "src.path.xml-comment",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/xml.c#L490-L523"
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:b7f8e9bf8321e83c287af3e9ca8831557bb4033e6f15b94ccfd0411ce9be8a5c
Text language: en · english-manuals:b7f8e9bf8321e83c287af3e9ca8831557bb4033e6f15b94ccfd0411ce9be8a5c