↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / SQLSTATE

22019 — invalid_escape_character

操作拒绝了给定的转义字符。

英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 18·选择有来源记录的版本

aliases
未知
class name
Data Exception
condition name
invalid_escape_character
lang
en
sqlstate
22019

版本定义 PG 18

速览 {#at-a-glance}

某个操作拒绝了它的转义参数。固定目录定义了 invalid_escape_character,但有限的 PostgreSQL 18.6 源码扫描没有找到可以安全绑定单一报文或严重级别的原生发出路径。

含义 {#meaning}

具体规则属于 ESCAPE 的消费者。PostgreSQL 的 LIKE 和 SIMILAR 文档允许一个字符的转义符,也允许用 ESCAPE '' 禁用转义,并特别说明这与 SQL 标准对零长度值的规定不同。其他消费者可能要求一个字符、拒绝某些字符,或有自己的空串规则。因此在没有发出路径时,不能用一条通用的长度或字符校验解释 22019。

诊断 {#diagnosis}

先确认消费者并阅读完整诊断,再修改值。检查转义表达式的解析类型和字符长度、值是否为空字符串,以及所选字符在该模式语言中是否有特殊含义。把 SQL 字符串字面量的引号处理与模式转义分开,并将本有限定义与 2200C 的 SIMILAR 分隔符语法、2200D 的无效字节区分开。

处理 {#response}

遵循消费者文档规定的转义表示:消费者要求时提供有效的单字符,消费者明确用空字符串(ESCAPE '')禁用转义时才使用这个支持的表示。必要时重新编码 SQL 字面量,然后在同一消费者中验证;不要把 LIKE 规则套到无关解析器上。

版本 {#versions}

锁定目录从 7.4 起记录该条件;固定源码覆盖 PostgreSQL 18.6。本次有限审阅没有确定精确的实现引入时间或原生发出路径。

相关 {#related}

2200C、2200D

来源 {#sources}

  • 固定定义已在 errcodes.txt 中核对;本次有限 PostgreSQL 18.6 源码扫描没有解析出 ERRCODE_INVALID_ESCAPE_CHARACTER 的出现位置。
  • 同版模式匹配文档说明 LIKE 的单字符、默认和空转义规则,#L5724-L5830说明对应的 SIMILAR 规则。这是消费者规则,不是对 22019 发出函数的声明。

运行核验为 not_run;本页不宣称 primary 模板、严重级别或事务影响。结构化证据记录保留定义、文档范围和有限发出路径限制。

比较版本

SQLSTATE 证据与已记录的运行版本

claims · identity
{
  "claim_id": "identity",
  "limits": "",
  "method": "Read the fixed errcodes row and macro.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "22019 is invalid_escape_character in SQLSTATE Class 22."
}
claims · consumer-rules
{
  "claim_id": "consumer-rules",
  "limits": "Other consumers may impose different escape rules.",
  "method": "Read the same-tag pattern-matching documentation.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.docs-pattern-escape.18.6"
  ],
  "statement": "Same-tag LIKE and SIMILAR documentation describes one-character escapes, the default backslash, and PostgreSQL's ESCAPE empty-string behavior; it does not identify a 22019 emitter."
}
claims · bounded-source-scope
{
  "claim_id": "bounded-source-scope",
  "limits": "This is not a claim that no external wrapper can report the condition.",
  "method": "Keep consumer documentation separate from an unresolved emitter search.",
  "position": 2,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The bounded PostgreSQL 18.6 source scan found no resolved native occurrence of ERRCODE_INVALID_ESCAPE_CHARACTER, so no primary or severity is attached."
}
claims · history
{
  "claim_id": "history",
  "limits": "",
  "method": "Use catalogue presence and history boundaries.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "The locked catalogue records 22019 from 7.4 without proving an exact implementation introduction date."
}
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#L189"
}
sources · src.docs-pattern-escape.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "doc/src/sgml/func.sgml",
  "position": 1,
  "sha256": "05d03f505dc3c3b4fb2b3a6e8ed3275c425306a8ff20dd9548e838c26bbb968a",
  "source_id": "src.docs-pattern-escape.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/func.sgml#L5551-L5830"
}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 18 · english-manuals:d748388f3c4cb7b54418476c49edaa844eeb2e3b930dbe76baaaa99b51cec55e

正文语言: zh-Hans · english-manuals:d748388f3c4cb7b54418476c49edaa844eeb2e3b930dbe76baaaa99b51cec55e