2200F
Read PG 18 manual ↗zero_length_character_string
- SQLSTATE
- 2200F
- Condition name
- zero_length_character_string
- Class
- Data Exception
- Source macro
- ERRCODE_ZERO_LENGTH_CHARACTER_STRING
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
The condition identifies an operation that rejects an empty character string. In the fixed fuzzystrmatch path, metaphone returns empty text immediately for empty input; only after that early return does it read reqlen, and a non-positive requested output length raises output cannot be empty string. A separate core array_to_tsvector path rejects an empty lexeme, so the message and function matter.
Meaning
This condition is reserved for an operation whose contract does not permit an empty character string. The fixed paths have different guards: metaphone(text, reqlen) first returns empty text when its input text is empty; after that early return, a non-positive reqlen on non-empty input raises 2200F. array_to_tsvector(text[]) independently rejects an element whose length is zero. Neither path proves that every empty SQL string is a 2200F error.
Messages
The metaphone guard raises ERROR with primary output cannot be empty string. The array_to_tsvector lexeme guard raises ERROR with primary lexeme array may not contain empty strings. These paths have no separate DETAIL or HINT in the cited branches.
Diagnosis
If the message names metaphone, inspect the supplied text and requested output length: empty input returns an empty result before reqlen is checked, while a non-positive length on non-empty input triggers 2200F. If the message names array_to_tsvector, inspect every lexeme for an empty string and distinguish NULL lexemes, which use 22004. For a different message, identify the named subsystem first; do not pad arbitrary output merely to silence the condition.
Response
Handle the named function’s input requirement explicitly: choose a positive metaphone output length for non-empty input, or remove/repair empty lexemes before array_to_tsvector. Preserve intended empty input semantics where the function permits them; do not pad data merely to suppress the code.
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
The locked catalogue records this condition from 7.4; fixed source coverage is PostgreSQL 18.6.
Sources
Fixed metaphone source: fuzzystrmatch.c#L253-287; the separate core lexeme guard is tsvector_op.c#L741-777. The structured evidence record retains both messages and scope boundaries. No natural runtime was run; SQLSTATE selection and message text remain the deciding evidence.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
2200F is zero_length_character_string in SQLSTATE Class 22.
Method: Read fixed definition.
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.
Method: Read the complete metaphone length guards.
Limits: The empty-input early return precedes the reqlen guard; this path does not make every empty SQL string a 2200F error.
array_to_tsvector rejects an empty lexeme with 2200F and primary lexeme array may not contain empty strings.
Method: Read the lexeme validation loop.
Limits: The tsvector path is distinct from metaphone and needs its own input repair.
The locked catalogue records 2200F from 7.4 without proving an exact implementation introduction date.
Method: Use catalogue boundary.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·- contrib/fuzzystrmatch/fuzzystrmatch.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/utils/adt/tsvector_op.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
ERROR · message.metaphone
Primary
output cannot be empty string
ERROR · message.tsvector
Primary
lexeme array may not contain empty strings
Reproduction & repair cases
No reproduction case is attached to this condition.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:8cdbd6fe815e0c7bbf60e948162… · English manual source