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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: MauMau <maumau307(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, alvherre(at)2ndquadrant(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [bug fix] multibyte messages are displayed incorrectly on the client
Date: 2014-01-11 01:03:00
Message-ID: 20513.1389402180@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Noah Misch <noah(at)leadboat(dot)com> writes:
>> On Sun, Jan 5, 2014 at 04:40:17PM +0900, MauMau wrote:
>>> 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().

> I like this proposal. Thanks.
> ...
> Agreed. You would need to poke into the relevant part of the startup packet
> much earlier than we do today, but that's tractable.

There's still the problem of what to do before we have a complete startup
packet, or if the packet is defective enough to not contain a recognizable
client encoding.

Perhaps more to the point, what it sounds like this is doing is creating
a third behavioral state, in between what prevails when we're first
reading the packet and what prevails after we've finally adopted the
requested client encoding. I'm less than convinced that's a good thing.

I'm also rather unexcited by the idea of introducing redundant and/or
ad-hoc code to parse the startup packet. That sounds like a recipe for
bugs, some of which might even rise to security issues, considering it
would happen before client authentication.

I think if we're going to do anything like this at all, it'd be best
just to disable localization from postmaster fork up till we've gotten
a client encoding out of the packet in the normal course of events.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Klaver 2014-01-11 01:06:58 Re: Standalone synchronous master
Previous Message Jim Nasby 2014-01-11 01:02:35 Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE