选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 错误代码 / Class 22 数据异常

2200T invalid_xml_processing_instruction

ERROR 源码确认 参考 未实测

类别
Class 22 数据异常
严重等级
ERROR
条件名
invalid_xml_processing_instruction
宏名称
ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION
启用版本
8.3
状态
活跃

版本覆盖

速览

XML 处理指令违反 XML 语法。PostgreSQL 18.6 的 xmlpi 路径拒绝大小写不敏感地等于 xml 的目标名,或含有 ?> 的非 NULL 内容;两条 guard 都报告 invalid XML processing instruction,并附加对应 DETAIL。

含义

本成员专用于 XML 处理指令语法,包括目标名和内容。xmlpi 用大小写不敏感比较检查目标名,因此 xmlXML 和混合大小写都会命中同一目标 guard。完成该语法检查后才应用 SQL NULL 规则:合法目标配 NULL 内容时返回 NULL;非 NULL 内容含有 ?> 时命中内容 guard。

报文

目标 guard 以 ERROR 报告 primary:invalid XML processing instruction,DETAIL 为 XML processing instruction target name cannot be "%s".。内容 guard 使用相同 primary,DETAIL 为 XML processing instruction cannot contain "?>".。引用分支没有独立 HINT。%s 是运行时目标名;合法目标下的 NULL 内容不是 2200T 错误。

报文模板

源码里的格式串,不是某一次运行的输出。%s 之类是占位符,实际报文会填入对象名与取值。适用范围一栏是核验时留下的原始英文记录,未经翻译。

主消息 invalid XML processing instruction
DETAIL XML processing instruction target name cannot be "%s".

来源:src/backend/utils/adt/xml.c @ REL_18_6

主消息 invalid XML processing instruction
DETAIL XML processing instruction cannot contain "?>".

来源:src/backend/utils/adt/xml.c @ REL_18_6

诊断

结合完整 message 和 detail 判断是目标名还是指令内容有问题。检查目标名规则,并在保持周围 XML 结构有效的前提下从内容中移除结尾 ?> 序列。不要用本成员规则去修复注释或一般文档错误。

处理

按 detail 指出的目标名或指令内容修正处理指令,保持 XML 结构有效并移除被禁止的处理指令形式。

该分支抛出 ERROR 时,显式事务应先用 ROLLBACK 恢复,或对语句前已建立的保存点执行 ROLLBACK TO SAVEPOINT,再重试;自动提交下只在失败语句结束后重试修正后的动作。事务边界规则见事务与重试指南。

版本

锁定目录从 8.3.0 起记录该条件;固定源码覆盖 PostgreSQL 18.6。

来源

证据

断言

每条断言都写明了是怎么核实的,以及它不覆盖什么。这一层是核验时留下的原始英文记录,照原样呈现,未经翻译。

  • 2200T is invalid_xml_processing_instruction in SQLSTATE Class 22.

    核实方式Read fixed definition.

    来源src/backend/utils/errcodes.txt

  • xmlpi rejects the target name xml and reports 2200T with a target-specific DETAIL.

    核实方式Read the target-name branch and its detail.

    不覆盖The NULL argument check follows the target check and returns NULL after a valid target.

    来源src/backend/utils/adt/xml.c

  • xmlpi also rejects a body containing ?> and reports 2200T with a body-specific DETAIL.

    核实方式Read the body validation branch.

    不覆盖Do not apply comment or document repairs to this processing-instruction path.

    来源src/backend/utils/adt/xml.c

  • The locked catalogue records 2200T from 8.3.0 without proving an exact implementation introduction date.

    核实方式Use catalogue boundary.

    来源src/backend/utils/errcodes.txt

同类错误代码

Class 22 数据异常 下的其他成员。