Diagnostic Queries
Symptoms
A character (often produced by chr() or a conversion) cannot be represented in the database/client encoding. PostgreSQL raises SQLSTATE 22P05 (untranslatable_character).
- The requested code point exceeds what the encoding supports.
- Common when generating characters in a non-UTF8 encoding.
- Conversions between encodings can also trigger it.
What the server log shows
ERROR: requested character too large for encoding: 1114112
Why PostgreSQL raises this — what the manual says
As Section 23.3 Character Set Support explains:
Functions such as chr() map a numeric code point to a character in the database encoding; a value larger than the largest code point the encoding can represent has no valid character and is rejected as too large for the encoding.
Each encoding supports a defined set of code points. When a requested character is outside that set (or has no equivalent during conversion), PostgreSQL cannot encode it and reports 22P05.
Common causes
chr()with a code point too large for the encoding.- Converting text containing characters absent from the target encoding.
- A non-UTF8 database asked to store a high Unicode code point.
How to fix it
- Use a UTF-8 database/encoding to support the full Unicode range.
- Validate code points before calling
chr()in non-UTF8 encodings. - Transliterate or strip unsupported characters during conversion.
Related & next steps
Reference: PostgreSQL 18 Section 24.3 “Character Set Support”.
Thanks — noted. This helps keep the database accurate.