Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U55Kh-0005fX-P3 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Feb 2013 02:10:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U55Kg-0001UJ-Th for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Feb 2013 02:10:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U55Kf-0001TY-VD for pgsql-hackers@postgresql.org; Tue, 12 Feb 2013 02:10:54 +0000 Received: from mail-ve0-f172.google.com ([209.85.128.172]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U55Kc-0002tf-VZ for pgsql-hackers@postgresql.org; Tue, 12 Feb 2013 02:10:53 +0000 Received: by mail-ve0-f172.google.com with SMTP id cz11so5676408veb.31 for ; Mon, 11 Feb 2013 18:10:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:x-gm-message-state; bh=jcY5ZuntGYm/DmUCmvY1DjOvXDmabHruVgmPkUWZNko=; b=fiD0nAvb42RwAFXR3dXEdBSn8GX6J+OpT0NJvJNwSy+G3TvaUPAFZd9NKxGenx8BPS HvylRsrV4s5/GkRObaPM1ydLuDGU/OiYW1Qjoe6yGHFqu2xJiol2Lu+qBAoTsbVFeQba iMqHaCs1zYxO4I6SSY2YsL6Qyh251BY1d5W6x4domlzvB4yoERwdgui2Y8SiuxGhrsRG DUJW0bZJHbL56l7yiseEFf6YPPtHcom8Z5g/5btNJQHcNpJejKZ1t7dcthFFzgcf7dm+ gdEJv7ODqp+jBq2u7l0NZuN53HjP95yQ5rvv3zO38cFsQcuR+qc475N3d+hPdBLbCCb1 KB9g== X-Received: by 10.220.40.135 with SMTP id k7mr21573669vce.12.1360635049235; Mon, 11 Feb 2013 18:10:49 -0800 (PST) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id ly6sm62194103veb.3.2013.02.11.18.10.46 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 Feb 2013 18:10:47 -0800 (PST) Date: Mon, 11 Feb 2013 21:10:45 -0500 From: Noah Misch To: Tom Lane Cc: Alexander Law , pgsql-hackers , Magnus Hagander , Andrew Dunstan Subject: Re: BUG #7493: Postmaster messages unreadable in a Windows console Message-ID: <20130212021045.GA7600@tornado.leadboat.com> References: <5100F3F6.3050107@2ndQuadrant.com> <51013C2C.5020703@dunslane.net> <20130124161954.GA2448@tornado.leadboat.com> <5101A1C4.3020407@dunslane.net> <5107656C.1050400@gmail.com> <28316.1359471244@sss.pgh.pa.us> <20130130015155.GD3524@tornado.leadboat.com> <5108B6E1.9070503@gmail.com> <20130210210259.GA7401@tornado.leadboat.com> <16160.1360540050@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16160.1360540050@sss.pgh.pa.us> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQlpUXzzt9buEToTy89BtDssLNMj2tyCegua/KGfHglA4eqtECn8sQN6Cgxy9xmUEllMXKdR X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Sun, Feb 10, 2013 at 06:47:30PM -0500, Tom Lane wrote: > Noah Misch writes: > > Following some actual testing, I see that we treat postgresql.conf values as > > byte sequences; any reinterpretation as encoded text happens later. Hence, > > contrary to my earlier suspicion, your patch does not make that situation > > worse. The present situation is bad; among other things, current_setting() is > > a vector for injecting invalid text data. But unconditionally validating > > postgresql.conf values in the platform encoding would not be an improvement. > > Suppose you have a UTF-8 platform encoding and KOI8R databases. You may wish > > to put KOI8R strings in a GUC, say search_path. That's possible today; if we > > required that postgresql.conf conform to the platform encoding and no other, > > it would become impossible. This area warrants improvement, but doing so will > > entail careful design. > > The key problem, ISTM, is that it's not at all clear what encoding to > expect the incoming data to be in. I'm concerned about trying to fix > that by assuming it's in some "platform encoding" --- for one thing, > while that might be a well-defined concept on Windows, I don't believe > it is anywhere else. GetPlatformEncoding() imposes a sufficiently-portable definition. I just don't think that definition leads to a value that can be presumed desirable and adequate for postgresql.conf. > If we knew that postgresql.conf was stored in, say, UTF8, then it would > probably be possible to perform encoding conversion to get string > variables into the database encoding. Perhaps we should allow some > magic syntax to tell us the encoding of a config file? > > file_encoding = 'utf8' # must precede any non-ASCII in the file > > There would still be a lot of practical problems to solve, like what to > do if we fail to convert some string into the database encoding. But at > least the problems would be somewhat well-defined. Agreed. That's a promising direction. > While we're thinking about this, it'd be nice to fix our handling (or > rather lack of handling) of encoding considerations for database names, > user names, and passwords. I could imagine adding some sort of encoding > marker to connection request packets, which could fix the don't-know- > the-encoding problem as far as incoming data is concerned. That deserves a TODO entry under Wire Protocol Changes to avoid losing it. > But how > shall we deal with storing the strings in shared catalogs, which have to > be readable from multiple databases possibly of different encodings? I suppose we would pick an encoding sufficient for all values we intend to support (UTF8? MULE_INTERNAL?), then store the data in that encoding using either bytea or a new type, say "omnitext". Thanks, nm -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers