2200S
PostgreSQLERRORCriticalData ExceptionHIGH confidence

invalid XML comment

What this means

SQLSTATE 2200S is raised when an XML comment is syntactically invalid — for example, containing double hyphens (--) within the comment body or not properly closed.

Why it happens
  1. 1XML comment containing -- within the comment body (not at the closing --)
  2. 2Unclosed XML comment (missing -->)
How to reproduce

XML document with an invalid comment.

trigger — this will error
trigger — this will error
SELECT XMLPARSE(DOCUMENT '<r><!-- bad -- comment --></r>');

expected output

ERROR:  invalid XML comment

Fix

Remove double hyphens from XML comment bodies

WHEN When constructing XML with comments programmatically.

Why this works

XML comments may not contain -- in the body. Replace -- with a single hyphen or remove comments from the XML.

Sources
Official documentation ↗

Class 22 — Data Exception

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors