Re: psql error (encoding related?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
Cc: BRUSSER Michael <Michael(dot)BRUSSER(at)3ds(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql error (encoding related?)
Date: 2017-01-05 22:04:09
Message-ID: 16366.1483653849@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?Q?Torsten_F=C3=B6rtsch?= <tfoertsch123(at)gmail(dot)com> writes:
> This hex string decodes to something sensible:
> $ perl -le 'print pack "H*", shift'
> 246c69626469722f757466385f616e645f69736f383835395f31
> $libdir/utf8_and_iso8859_1

> Maybe it rings a bell.

Hah, that's pretty suggestive. So probably, there's an encoding
conversion function that's been registered with a messed-up library name,
and the failure occurs when trying to connect with a client-side locale
that needs to use that encoding conversion. We know the database uses
UTF8, so the failure must occur with ISO-8859-1 as the client encoding.

It's hard to guess how the function's probin value got messed up though.
All those functions should have been created during initdb, and there's
no good reason why they should get changed later. I see this in a 9.4
database:

regression=# select oid, xmin, proname, probin from pg_proc where probin ~ 'utf8_and_iso8859_1';
oid | xmin | proname | probin
-------+------+-------------------+----------------------------
12392 | 1635 | iso8859_1_to_utf8 | $libdir/utf8_and_iso8859_1
12394 | 1639 | utf8_to_iso8859_1 | $libdir/utf8_and_iso8859_1
(2 rows)

although the OIDs and xmin value might vary in other installations.

>> And if anyone from the Postgres team listening... in the old tradition of
>> whining I would add that the error message referring to a long hex string
>> is not helpful!

This should be a can't-happen failure ... it's not very clear to me how we
could produce a better message for it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick B 2017-01-05 22:07:37 FATAL: requested WAL segment has already been removed
Previous Message Torsten Förtsch 2017-01-05 21:43:17 Re: psql error (encoding related?)