22P05
Read PG 18 manual ↗untranslatable_character
- SQLSTATE
- 22P05
- Condition name
- untranslatable_character
- Class
- Data Exception
- Source macro
- ERRCODE_UNTRANSLATABLE_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
PostgreSQL could identify a source character but could not represent it in the destination encoding. The fixed helper reports the offending bytes and both encoding names with primary character with byte sequence %s in encoding "%s" has no equivalent in encoding "%s" at ERROR severity.
Meaning
report_untranslatable_char(src_encoding, dest_encoding, ...) determines the source multibyte length, formats the offending bytes as 0x.., and raises 22P05 when the destination conversion table has no equivalent character. This means the source character is valid enough to identify, but the target representation cannot carry it. It is different from malformed source bytes: the fixed conversion loop can call report_invalid_encoding, which uses 22021 instead.
Messages
ERRORprimary:character with byte sequence %s in encoding "%s" has no equivalent in encoding "%s"- The fixed call supplies no DETAIL or HINT.
Diagnosis
Read the exact byte sequence, source encoding, destination encoding, and conversion direction from the primary. Check client_encoding, server/database encoding, import or COPY file encoding, and the actual conversion boundary. Do not treat the presence of a non-ASCII character as proof of 22P05; malformed source bytes and ordinary type-input failures have different paths.
Response
Choose a destination encoding that represents the data, or correct the producer and conversion boundary while preserving the character. Do not silently replace or discard it unless loss is an explicit data policy. Because the cited path is ERROR, an explicit transaction needs ROLLBACK or ROLLBACK TO SAVEPOINT before retrying; in autocommit, correct the encoding or input and submit again. This source path does not imply a connection reset or a FATAL session end.
Versions
The locked catalogue records this condition from PostgreSQL 7.4. The reporting helper and representative conversion branch cited here are from PostgreSQL 18.6 REL_18_6; no encoding runtime was executed.
Sources
src/backend/utils/mb/mbutils.c#L1862-L1902
src/backend/utils/mb/conv.c#L674-L684
The structured evidence record records the exact primary and the valid-character versus malformed-byte boundary.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
22P05 is untranslatable_character in SQLSTATE Class 22.
Method: Read fixed definition.
report_untranslatable_char computes source multibyte character bytes and reports source and destination encoding names when conversion has no equivalent destination character.
Method: Read the complete reporting function.
The conversion loop calls report_untranslatable_char for a valid source character with no destination mapping, while malformed remaining UTF-8 bytes fall through to report_invalid_encoding and 22021.
Method: Read the conversion failure and invalid-input branches.
Limits: The cited loop is representative; other conversion procedures call the same reporting helper.
The locked catalogue records 22P05 from 7.4; that boundary does not prove exact implementation introduction.
Method: Use catalogue boundary.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/utils/mb/mbutils.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/utils/mb/conv.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
ERROR · message.convert
Primary
character with byte sequence %s in encoding "%s" has no equivalent in encoding "%s"
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:8908bd52048f21612c453e98ff1… · English manual source