Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U4e3K-0005t6-4R for pgsql-hackers@arkaria.postgresql.org; Sun, 10 Feb 2013 21:03:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U4e3J-0005SI-Gh for pgsql-hackers@arkaria.postgresql.org; Sun, 10 Feb 2013 21:03:09 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U4e3I-0005SD-DC for pgsql-hackers@postgresql.org; Sun, 10 Feb 2013 21:03:08 +0000 Received: from mail-ve0-f180.google.com ([209.85.128.180]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U4e3F-0007oP-Ew for pgsql-hackers@postgresql.org; Sun, 10 Feb 2013 21:03:07 +0000 Received: by mail-ve0-f180.google.com with SMTP id jx10so4545237veb.25 for ; Sun, 10 Feb 2013 13:03:04 -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=07TCO1Gq/AXhAjK0u79HVI+QmYn1NqfdyPpprPGTNrU=; b=RLGb2O5JSEZEFbZEv22ukhEyLAwQcFuVglI59ZTAq7JsY27pwsfX/vbJ3P8GWZRB7B jcdjz7ptIWlVLXwrwdGotMMtoO4ELoil77nowiWOsXkFoCAfigZ4GjDAijRyOBR4YYAx +y0b06N+3G+9JeC7eVlEXdZd4VZ2Ra7nnNyFH8H8zEMLX3sbM17uUJRF8NSvenwRZWH8 25fmhbc6UY8RVbNVU8ynjoMS6SgWuQvHpkhgpJrw0bRY/AwrWWi23t+9hNgMH8rBBIVW tc7SpQO/7k8naJDtEhawi5zlQELAIUWMhm6DREXColyhGPX1kbqzlTMN4qv+BDNdmmDA Gw9g== X-Received: by 10.220.241.80 with SMTP id ld16mr16359941vcb.5.1360530183993; Sun, 10 Feb 2013 13:03:03 -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 cl9sm56029480vdb.3.2013.02.10.13.03.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 10 Feb 2013 13:03:02 -0800 (PST) Date: Sun, 10 Feb 2013 16:02:59 -0500 From: Noah Misch To: Alexander Law Cc: Tom Lane , pgsql-hackers , Magnus Hagander , Andrew Dunstan Subject: Re: BUG #7493: Postmaster messages unreadable in a Windows console Message-ID: <20130210210259.GA7401@tornado.leadboat.com> References: <20121018154650.GA3763@alvh.no-ip.org> <51001879.3000207@gmail.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5108B6E1.9070503@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQnUYy0tFnNPNJVdw1Klm2JtvkTftu4wi3QrW1qKDg01QIgD6rHJgNUxoLlWNZFprr65VWNB 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 Wed, Jan 30, 2013 at 10:00:01AM +0400, Alexander Law wrote: > 30.01.2013 05:51, Noah Misch wrote: >> On Tue, Jan 29, 2013 at 09:54:04AM -0500, Tom Lane wrote: >>> Alexander Law writes: >>>> Please look at the following l10n bug: >>>> http://www.postgresql.org/message-id/502A26F1.6010109@gmail.com >>>> and the proposed patch. >> Even then, I wouldn't be surprised to find problematic consequences beyond >> error display. What if all the databases are EUC_JP, the platform encoding is >> KOI8, and some postgresql.conf settings contain EUC_JP characters? Does the >> postmaster not rely on its use of SQL_ASCII to allow those values? >> >> I would look at fixing this by making the error output machinery smarter in >> this area before changing the postmaster's notion of server_encoding. With your proposed change, the problem will resurface in an actual SQL_ASCII database. At the problem's root is write_console()'s assumption that messages are in the database encoding. pg_bind_textdomain_codeset() tries to make that so, but it only works for encodings with a pg_enc2gettext_tbl entry. That excludes SQL_ASCII, MULE_INTERNAL, and others. write_console() needs to behave differently in such cases. > Maybe I still miss something but I thought that > postinit.c/CheckMyDatabase will switch encoding of a messages by > pg_bind_textdomain_codeset to EUC_JP so there will be no issues with it. > But until then KOI8 should be used. > Regarding postgresql.conf, as it has no explicit encoding specification, > it should be interpreted as having the platform encoding. So in your > example it should contain KOI8, not EUC_JP characters. 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. 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