Seaquel
PostgreSQL error code

PostgreSQL error 22021

22021 is the SQLSTATE PostgreSQL reports for character not in repertoire, in class 22, Data Exception.

SQLSTATE22021
Condition namecharacter_not_in_repertoire
Class22 — Data Exception

Reproduce it, then fix it

The bytes aren’t valid UTF-8: 0xe9 is é in Latin-1, but in UTF-8 it has to be followed by more bytes. Data like this usually comes from a Latin-1 or Windows-1252 file, so decode it with that encoding. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.

SELECT convert_from('\x436166e9'::bytea, 'UTF8');
SELECT convert_from('\x436166e9'::bytea, 'LATIN1');

Source: PostgreSQL documentation, Appendix A