↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQLSTATE

2200T — invalid_xml_processing_instruction

An XML processing instruction violates its XML syntax. PostgreSQL 18.6’s xmlpi path rejects a target whose name is case-insensitively xml, or a non-NULL body containing ?>; both guards report invalid XML processing instruction with a branch-specific DETAIL.

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_processing_instruction
lang
en
sqlstate
2200T

Definition PG 18

2200T

At a glance {#at-a-glance}

An XML processing instruction violates its XML syntax. PostgreSQL 18.6’s xmlpi path rejects a target whose name is case-insensitively xml, or a non-NULL body containing ?>; both guards report invalid XML processing instruction with a branch-specific DETAIL.

Meaning {#meaning}

This member is specific to XML processing-instruction syntax, including its target name and body. xmlpi checks the target with case-insensitive comparison, so xml, XML, and mixed-case forms hit the same target guard. Only after that syntax check does it apply the SQL NULL rule: a NULL body returns NULL for a valid target. A non-NULL body containing ?> hits the body guard.

Messages {#messages}

The target guard raises ERROR with primary invalid XML processing instruction and DETAIL XML processing instruction target name cannot be "%s".. The body guard uses the same primary and DETAIL XML processing instruction cannot contain "?>".. The cited branches have no separate HINT. %s is the runtime target name; a NULL body after a valid target is not a 2200T error.

Diagnosis {#diagnosis}

Use the full message and detail to identify whether the target name or the instruction body is wrong. Check the target-name rule and remove the terminating ?> sequence from the body while keeping the surrounding XML structure valid. Do not repair a comment or a general document error using this member’s rules.

Response {#response}

Repair the target name or instruction body named by the detail, preserving valid XML structure and removing the forbidden processing-instruction form.

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}

2200L, 2200S

Sources {#sources}

Fixed source: src/backend/utils/adt/xml.c#L1010-1055. The structured evidence record retains both guards, message/detail variants, NULL ordering, and scope boundaries. Target names and instruction content are runtime values; no natural XML runtime was run.

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": "2200T is invalid_xml_processing_instruction in SQLSTATE Class 22."
}
claims · mechanism.target
{
  "claim_id": "mechanism.target",
  "limits": "The NULL argument check follows the target check and returns NULL after a valid target.",
  "method": "Read the target-name branch and its detail.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.path.xmlpi"
  ],
  "statement": "xmlpi rejects the target name xml and reports 2200T with a target-specific DETAIL."
}
claims · mechanism.body
{
  "claim_id": "mechanism.body",
  "limits": "Do not apply comment or document repairs to this processing-instruction path.",
  "method": "Read the body validation branch.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.path.xmlpi"
  ],
  "statement": "xmlpi also rejects a body containing ?\u003e and reports 2200T with a body-specific DETAIL."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue boundary.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 2200T from 8.3.0 without proving an exact implementation introduction date."
}
messages · message.target
{
  "limits": "",
  "message_id": "message.target",
  "path": "",
  "position": 0,
  "raw": {
    "detail_template": "XML processing instruction target name cannot be \"%s\".",
    "id": "message.target",
    "primary_template": "invalid XML processing instruction",
    "severity_source": "ERROR",
    "sources": [
      "src.path.xmlpi"
    ],
    "sqlstate": "2200T"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.xmlpi"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "invalid XML processing instruction",
      "position": 0,
      "role": "",
      "template": "invalid XML processing instruction"
    },
    {
      "kind": "detail",
      "literal": "XML processing instruction target name cannot be \" \".",
      "position": 1,
      "role": "",
      "template": "XML processing instruction target name cannot be \"%s\"."
    }
  ]
}
messages · message.body
{
  "limits": "",
  "message_id": "message.body",
  "path": "",
  "position": 1,
  "raw": {
    "detail_template": "XML processing instruction cannot contain \"?\u003e\".",
    "id": "message.body",
    "primary_template": "invalid XML processing instruction",
    "severity_source": "ERROR",
    "sources": [
      "src.path.xmlpi"
    ],
    "sqlstate": "2200T"
  },
  "severity": "ERROR",
  "sources": [
    "src.path.xmlpi"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "invalid XML processing instruction",
      "position": 0,
      "role": "",
      "template": "invalid XML processing instruction"
    },
    {
      "kind": "detail",
      "literal": "XML processing instruction cannot contain \"?\u003e\".",
      "position": 1,
      "role": "",
      "template": "XML processing instruction cannot contain \"?\u003e\"."
    }
  ]
}
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#L214"
}
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.xmlpi
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/adt/xml.c",
  "position": 2,
  "sha256": "f1c70b5ee5ee9a20a41d9b2c27bc7a8a50dbd47d9489ba462a4a678f7f55f14d",
  "source_id": "src.path.xmlpi",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/xml.c#L1010-L1055"
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:442eafe8e6a84df21d47b90e60c70d8cc1eb2f83929e95d9dbd9ae387a8fa797

Text language: en · english-manuals:442eafe8e6a84df21d47b90e60c70d8cc1eb2f83929e95d9dbd9ae387a8fa797