When encountering error 22P05: Untranslatable Character in a PostgreSQL database, follow these steps to investigate and address the issue:
SELECT * FROM pg_read_file('log_filename', 0, 1048576) WHERE log_line LIKE '%22P05%';
Replace 'log_filename'
with the actual log file name, which you can find in your PostgreSQL configuration file (postgresql.conf
) under the log_filename
parameter.SHOW server_encoding;
SHOW client_encoding;
Ensure that the client encoding is compatible with the server encoding or is set to a universal encoding like UTF-8 that can handle a wide range of characters.psql
or another database client, ensuring to set the client encoding appropriately. For psql
, you can set the client encoding by running:SET client_encoding TO 'desired_encoding';
Replace 'desired_encoding'
with the encoding you wish to use, like 'UTF8'.SET client_encoding TO 'WIN1252';
Remember to set it back to its original setting after performing the necessary operations.Each of these steps involves direct interaction with the database or the data, aimed at identifying or correcting the specific issue causing the "Untranslatable Character" error.
Let Dr. Droid create custom investigation plans for your infrastructure.
Start Free POC (15-min setup) →