2200F — zero_length_character_string
操作拒绝了零长度字符串。
英文手册覆盖始于 PostgreSQL 8.1. 来源历史与运行验证各自保留独立版本边界。
当前阅读 PG 18·选择有来源记录的版本
- aliases
- 未知
- class name
- Data Exception
- condition name
- zero_length_character_string
- lang
- en
- sqlstate
- 2200F
版本定义 PG 18
2200F
速览 {#at-a-glance}
该条件表示某项操作拒绝空字符字符串。在固定的 fuzzystrmatch 路径中,metaphone 会先对空输入返回空文本;只有经过这个提前返回后才读取 reqlen,非正的请求输出长度才会报告 output cannot be empty string。另一个核心 array_to_tsvector 路径会拒绝空 lexeme,因此必须结合报文和函数判断。
含义 {#meaning}
本条件用于某项操作的输入要求不允许空字符字符串的情况。固定路径有不同 guard:metaphone(text, reqlen) 先在输入为空时返回空文本;对非空输入才检查 reqlen,reqlen <= 0 时触发 2200F。array_to_tsvector(text[]) 则独立拒绝长度为零的元素。两条路径都不能证明每个空 SQL 字符串都会产生 2200F。
报文 {#messages}
metaphone guard 以 ERROR 严重性报告 primary:output cannot be empty string;array_to_tsvector lexeme guard 以 ERROR 报告 primary:lexeme array may not contain empty strings。引用分支没有独立 DETAIL 或 HINT。
诊断 {#diagnosis}
如果报文指向 metaphone,检查传入文本和请求输出长度:空输入在检查 reqlen 前返回空结果,只有非空输入的非正长度才会触发 2200F。如果报文指向 array_to_tsvector,检查每个 lexeme 是否为空,并区分使用 22004 的 NULL lexeme。若报文不同,先定位其中点名的子系统;不要为了消除条件而随意填充输出。
处理 {#response}
明确处理报文所指函数的输入要求:为非空 metaphone 输入选择正的输出长度,或在 array_to_tsvector 前移除/修正空 lexeme。函数允许时保留有意的空输入语义;不要只为压制代码而填充数据。
该分支抛出 ERROR 时,显式事务应先用 ROLLBACK 恢复,或对语句前已建立的保存点执行 ROLLBACK TO SAVEPOINT,再重试;自动提交下只在失败语句结束后重试修正后的动作。事务边界规则见事务与重试指南。
版本 {#versions}
锁定目录从 7.4 起记录该条件;固定源码覆盖 PostgreSQL 18.6。
相关 {#related}
来源 {#sources}
固定 metaphone 源码:fuzzystrmatch.c#L253-287;独立的核心 lexeme guard 见 tsvector_op.c#L741-777。结构化证据记录保留两条消息和范围边界。本页未运行自然案例;实际 SQLSTATE 和报文仍是判断依据。
比较版本
SQLSTATE 证据与已记录的运行版本
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read fixed definition.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "2200F is zero_length_character_string in SQLSTATE Class 22."
}claims · mechanism.metaphone
{
"claim_id": "mechanism.metaphone",
"limits": "The empty-input early return precedes the reqlen guard; this path does not make every empty SQL string a 2200F error.",
"method": "Read the complete metaphone length guards.",
"position": 1,
"runtime": [],
"sources": [
"src.path.metaphone"
],
"statement": "The contrib fuzzystrmatch metaphone function returns an empty text result at its empty-input early return; after that return, a non-empty input with non-positive requested output length raises 2200F with primary output cannot be empty string."
}claims · mechanism.tsvector
{
"claim_id": "mechanism.tsvector",
"limits": "The tsvector path is distinct from metaphone and needs its own input repair.",
"method": "Read the lexeme validation loop.",
"position": 2,
"runtime": [],
"sources": [
"src.path.tsvector-empty"
],
"statement": "array_to_tsvector rejects an empty lexeme with 2200F and primary lexeme array may not contain empty strings."
}claims · history
{
"claim_id": "history",
"limits": "",
"method": "Use catalogue boundary.",
"position": 3,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "The locked catalogue records 2200F from 7.4 without proving an exact implementation introduction date."
}messages · message.metaphone
{
"limits": "",
"message_id": "message.metaphone",
"path": "",
"position": 0,
"raw": {
"id": "message.metaphone",
"primary_template": "output cannot be empty string",
"severity_source": "ERROR",
"sources": [
"src.path.metaphone"
],
"sqlstate": "2200F"
},
"severity": "ERROR",
"sources": [
"src.path.metaphone"
],
"templates": [
{
"kind": "primary",
"literal": "output cannot be empty string",
"position": 0,
"role": "",
"template": "output cannot be empty string"
}
]
}messages · message.tsvector
{
"limits": "",
"message_id": "message.tsvector",
"path": "",
"position": 1,
"raw": {
"id": "message.tsvector",
"primary_template": "lexeme array may not contain empty strings",
"severity_source": "ERROR",
"sources": [
"src.path.tsvector-empty"
],
"sqlstate": "2200F"
},
"severity": "ERROR",
"sources": [
"src.path.tsvector-empty"
],
"templates": [
{
"kind": "primary",
"literal": "lexeme array may not contain empty strings",
"position": 0,
"role": "",
"template": "lexeme array may not contain empty strings"
}
]
}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#L204"
}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.metaphone
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/fuzzystrmatch/fuzzystrmatch.c",
"position": 2,
"sha256": "bd5b12031fa6ca844b8d4e2c2ced490b7233cc9e35c77ef681cb620c7367a591",
"source_id": "src.path.metaphone",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/fuzzystrmatch/fuzzystrmatch.c#L253-L287"
}sources · src.path.tsvector-empty
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/adt/tsvector_op.c",
"position": 3,
"sha256": "5ea1783f4023be82a092fbfc66a59d2586cd63352c375e2c8d599bc98bccfe8f",
"source_id": "src.path.tsvector-empty",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/adt/tsvector_op.c#L741-L777"
}来源引用
定义来源
center · PostgreSQL 18 · english-manuals:8043f72e38dd0f102d02ee6a9d3b8b9f17221d088909caed384815793df7dce7
正文语言: zh-Hans · english-manuals:8043f72e38dd0f102d02ee6a9d3b8b9f17221d088909caed384815793df7dce7