SQLSTATE 2200SSeverity lowLab verified

Incident brief

Invalid XML comment

xmlcomment() rejects text that would produce an illegal XML comment — XML comments cannot contain a double hyphen or end with a hyphen.

Reproduced on PostgreSQL 18.4Verified 2026-07-24 (isolated lab, PostgreSQL 18.4)Reviewed by Verified against PostgreSQL 18.4 in an isolated lab environment

In 10 seconds

What
Invalid XML comment
What triggers it
Call xmlcomment(text) with text that contains '--' or ends with '-'.
The fix
Remove or replace '--' sequences (and any trailing '-') in the comment text.
Proof
Reproduced on PostgreSQL 18.4 → A single SELECT reproduces SQLSTATE 2200S; the illegal comment text is rejected by xmlcomment().

The fix

What to do right now

The immediate, application-level response to this error.

  • Remove or replace '--' sequences (and any trailing '-') in the comment text.
  • Sanitize interpolated text before wrapping it in xmlcomment().
Fix — SQL
-- XML comments cannot contain '--' or end with '-'.
SELECT xmlcomment('build failed');

Related & next steps

Follow the thread

Everything this error touches — jump straight to the sibling error, term, runbook, or parameter.

Verification

PG 18.4
Last verified
2026-07-24 (isolated lab, PostgreSQL 18.4)
Reviewed by
Verified against PostgreSQL 18.4 in an isolated lab environment
Audit status
reviewed