SQLSTATE 22P05 ERROR Class 22: Data Exception

untranslatable_character requested character too large for encoding: N — 22P05

PostgreSQL error "requested character too large for encoding: N" (SQLSTATE 22P05): what it means, common causes, and how to fix it.

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

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

  1. Use a UTF-8 database/encoding to support the full Unicode range.
  2. Validate code points before calling chr() in non-UTF8 encodings.
  3. Transliterate or strip unsupported characters during conversion.

Related & next steps

Reference: PostgreSQL 18 Section 24.3 “Character Set Support”.

Was this helpful?