"Antonio Mari" <amari@at4.net> writes:
> LC_COLLATE: es_ES@euro
> LC_CTYPE: es_ES@euro
> As you see the initdb was initialized with es_ES@euro locale (LATIN9).
> When connecting via psql to a database encoded in UTF8 and client_encoding
> is LATIN9 (or LATIN1) and try a wrong query I've the PANIC error.
This is pilot error: you must have LC_COLLATE and LC_CTYPE compatible
with the database encoding. The reason is that gettext looks to those
to determine what encoding to return localized error messages in, but
Postgres thinks they are in the database encoding, and only finds out
its mistake when it has to translate to another encoding. Of course,
the error message reporting *that* also has to be translated ...
There are a lot of other things that don't work well when the locale
settings don't match the database encoding, so my advice is "don't do
that".
regards, tom lane