22019
Read PG 18 manual ↗invalid_escape_character
- SQLSTATE
- 22019
- Condition name
- invalid_escape_character
- Class
- Data Exception
- Source macro
- ERRCODE_INVALID_ESCAPE_CHARACTER
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
An operation rejected its escape argument. The fixed catalogue defines invalid_escape_character, but the bounded PostgreSQL 18.6 source scan found no native emitter to which one message or severity can safely be attached.
Meaning
The relevant rule belongs to the consumer of ESCAPE. PostgreSQL's LIKE and SIMILAR documentation permits a one-character escape, allows ESCAPE '' to disable escaping, and distinguishes that behavior from the SQL standard's zero-length rule. Another consumer may require one character, reject a character class, or apply its own empty-string rule. Therefore 22019 cannot be explained by one universal length or character check without an emitting path.
Diagnosis
Identify the consumer and read its complete diagnostic before changing the value. Check the escape expression's resolved type and character length, whether the value is an empty string, and whether the chosen character has a special meaning in that pattern language. Keep SQL string-literal quoting separate from pattern escaping, and distinguish this bounded definition from 2200C SIMILAR separator syntax and 2200D invalid octets.
Response
Use the consumer's documented escape representation: a valid single character where that consumer requires one, or the explicitly supported empty string (ESCAPE '') where it disables escaping. Re-encode the SQL literal as needed, then validate the same consumer; do not apply a LIKE rule to an unrelated parser.
Versions
The locked catalogue records this condition from 7.4; fixed source coverage is PostgreSQL 18.6. The exact implementation introduction date and native emitter remain unresolved by this bounded review.
Sources
- The fixed definition is confirmed in
errcodes.txt; no occurrence ofERRCODE_INVALID_ESCAPE_CHARACTERwas resolved in the bounded PostgreSQL 18.6 source scan. - Same-tag pattern-matching documentation documents LIKE's one-character/default/empty escape behavior, and
#L5724-L5830documents the corresponding SIMILAR rules. These are consumer rules, not a claimed22019emitter.
Runtime verification is not_run; this page does not assert a primary template, severity, or transaction effect. The structured evidence record retains the definition, documentation scope, and bounded-emitter limitation.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
22019 is invalid_escape_character in SQLSTATE Class 22.
Method: Read the fixed errcodes row and macro.
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.
Method: Read the same-tag pattern-matching documentation.
Limits: Other consumers may impose different escape rules.
The bounded PostgreSQL 18.6 source scan found no resolved native occurrence of ERRCODE_INVALID_ESCAPE_CHARACTER, so no primary or severity is attached.
Method: Keep consumer documentation separate from an unresolved emitter search.
Limits: This is not a claim that no external wrapper can report the condition.
The locked catalogue records 22019 from 7.4 without proving an exact implementation introduction date.
Method: Use catalogue presence and history boundaries.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - doc/src/sgml/func.sgml · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
No extracted message template is attached to this condition.
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:0fb3c7fbb77e86aa311101b9f97… · English manual source