Andreas <maps.on@gmx.net> writes:
> I've got pg 8.1.4 from the binary Windows installer.
> Windows 2000 / German
> Now I entered "\d" into psql on the text-console and got this:
>
> db_test=# \d
> ERROR: invalid byte sequence for encoding "UTF8": 0xfc6d6572220a
I can replicate this by using a UTF8 database and running the client
in a non-UTF8 locale. For example
$ LANG=de_DE.iso88591 psql postgres
Dies ist psql 8.2devel, das interaktive PostgreSQL-Terminal.
Geben Sie ein: \copyright f�r Urheberrechtsinformationen
\h f�r Hilfe �ber SQL-Anweisungen
\? f�r Hilfe �ber interne Anweisungen
\g oder Semikolon, um eine Anfrage auszuf�hren
\q um zu beenden
postgres=# \l
ERROR: invalid byte sequence for encoding "UTF8": 0xfc6d6572222c
TIP: This error can also happen if the byte sequence does not match the encoding expected by the server, which is
controlledby "client_encoding".
postgres=# \d
ERROR: invalid byte sequence for encoding "UTF8": 0xfc6d6572220a
TIP: This error can also happen if the byte sequence does not match the encoding expected by the server, which is
controlledby "client_encoding".
postgres=# \encoding
UTF8
postgres=#
The problem here is that psql is using gettext() to convert column
headings for its display to German, and gettext() sees its locale
as specifying ISO8859-1, so that's the encoding it produces. When
that data is sent over to the server --- which thinks that the
client is using UTF8 encoding, because it hasn't been told any
different --- the server quite naturally barfs.
We've known about this and related issues with gettext for some time,
but a bulletproof solution isn't clear. For the moment all you can
do is be real careful about making your locale settings match up.
regards, tom lane