2200N
PostgreSQLERRORNotableData ExceptionHIGH confidence

invalid XML content

What this means

SQLSTATE 2200N is raised when XML content (a fragment, not a full document) fails well-formedness checks when parsed with XMLPARSE(CONTENT ...).

Why it happens
  1. 1XML fragment with syntax errors passed to an XML CONTENT context
How to reproduce

Parsing an invalid XML fragment.

trigger — this will error
trigger — this will error
SELECT XMLPARSE(CONTENT '<a>unclosed');

expected output

ERROR:  invalid XML content

Fix

Fix the XML fragment syntax

WHEN When parsing XML content fragments.

Fix the XML fragment syntax
SELECT XMLPARSE(CONTENT '<a>closed</a>');

Why this works

Ensure all tags are properly closed and the fragment is well-formed 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