Re: [bug fix] multibyte messages are displayed incorrectly on the client

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [bug fix] multibyte messages are displayed incorrectly on the client
Дата
Msg-id 22855.1396673760@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [bug fix] multibyte messages are displayed incorrectly on the client  ("MauMau" <maumau307@gmail.com>)
Ответы Re: [bug fix] multibyte messages are displayed incorrectly on the client  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-hackers
"MauMau" <maumau307@gmail.com> writes:
>> Then, as a happy medium, how about disabling message localization only if 
>> the client encoding differs from the server one?  That is, compare the 
>> client_encoding value in the startup packet with the result of 
>> GetPlatformEncoding().  If they don't match, call 
>> disable_message_localization().

AFAICT this is not what was agreed to in this thread.  It puts far too
much credence in the server-side default for client_encoding, which up to
now has never been thought to be very interesting; indeed I doubt most
people bother to set it at all.  The reason that this issue is even on
the table is that that default is too likely to be wrong, no?

Also, whatever possessed you to use pg_get_encoding_from_locale to
identify the server's encoding?  That's expensive and seems fairly
unlikely to yield the right answer.  I don't remember offhand where we
keep the postmaster's idea of what encoding messages should be in, but I'm
fairly sure it's stored explicitly somewhere.  Or if it isn't, we can for
sure do better than recalculating it during every connection attempt.

Having said all that, though, I'm unconvinced that this cure isn't worse
than the disease.  Somebody claimed upthread that no very interesting
messages would be delocalized by a change like this, but that's complete
nonsense: in particular, *every* message associated with client
authentication will be sent in English if we go down this path.  Given
the nearly complete lack of complaints in the many years that this code
has worked like this, I'm betting that most people will find a change
like this to be a net reduction in friendliness.

Given the changes here to extract client_encoding from the startup packet
ASAP, I wonder whether the right thing isn't just to set the client
encoding immediately when we do that.  Most application libraries pass
client encoding in the startup packet anyway (libpq certainly does).
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Idea for aggregates
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Fwd: Proposal: variant of regclass