Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VNVgy-0003wc-NY for pgsql-hackers@arkaria.postgresql.org; Sat, 21 Sep 2013 22:30:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VNVgx-0006ki-UH for pgsql-hackers@arkaria.postgresql.org; Sat, 21 Sep 2013 22:30:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VNVgw-0006kZ-Eg for pgsql-hackers@postgresql.org; Sat, 21 Sep 2013 22:30:18 +0000 Received: from sraihb2.sra.co.jp ([202.32.10.6]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VNVgr-0000XN-Sa; Sat, 21 Sep 2013 22:30:18 +0000 Received: from srascc.sra.co.jp (srascc [133.137.8.66]) by sraihb2.sra.co.jp (Postfix) with SMTP id EBC5F2A16AD; Sun, 22 Sep 2013 07:30:10 +0900 (JST) Received: from (srascb.sra.co.jp [133.137.8.65]) by srascc.sra.co.jp with smtp id 2070_0c4d_6037c95c_230d_11e3_a70b_001d096c60d0; Sun, 22 Sep 2013 07:30:09 +0900 Received: from sranhm.sra.co.jp (osspc25 [133.137.176.97]) by srascb.sra.co.jp (Postfix) with ESMTP id 9BD42110C73; Sun, 22 Sep 2013 07:30:10 +0900 (JST) Received: from localhost (sraihb-hub.sra.co.jp [133.137.8.6]) by sranhm.sra.co.jp (Postfix) with ESMTP id 3C5C4A0861; Sun, 22 Sep 2013 07:30:10 +0900 (JST) Date: Sun, 22 Sep 2013 07:29:52 +0900 (JST) Message-Id: <20130922.072952.1977066018971837040.t-ishii@sraoss.co.jp> To: robertmhaas@gmail.com Cc: ishii@postgresql.org, maumau307@gmail.com, tgl@sss.pgh.pa.us, maksymb@fast.au.fujitsu.com, hlinnakangas@vmware.com, pgsql-hackers@postgresql.org Subject: Re: UTF8 national character data type support WIP patch and list of open issues. From: Tatsuo Ishii In-Reply-To: References: <20130920.085853.1628917054830864151.t-ishii@sraoss.co.jp> X-Mailer: Mew version 6.3 on Emacs 23.3 / Mule 6.0 =?iso-2022-jp?B?KBskQjJWOzZOJBsoQik=?= Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 > I think the point here is that, at least as I understand it, encoding > conversion and sanitization happens at a very early stage right now, > when we first receive the input from the client. If the user sends a > string of bytes as part of a query or bind placeholder that's not > valid in the database encoding, it's going to error out before any > type-specific code has an opportunity to get control. Look at > textin(), for example. There's no encoding check there. That means > it's already been done at that point. To make this work, someone's > going to have to figure out what to do about *that*. Until we have a > sketch of what the design for that looks like, I don't see how we can > credibly entertain more specific proposals. I don't think the bind placeholder is the case. That is processed by exec_bind_message() in postgres.c. It has enough info about the type of the placeholder, and I think we can easily deal with NCHAR. Same thing can be said to COPY case. Problem is an ordinary query (simple protocol "Q" message) as you pointed out. Encoding conversion happens at a very early stage (note that fast-path case has the same issue). If a query message contains, say, SHIFT-JIS and EUC-JP, then we are going into trouble because the encoding conversion routine (pg_client_to_server) regards that the message from client contains only one encoding. However my question is, does it really happen? Because there's any text editor which can create SHIFT-JIS and EUC-JP mixed text. So my guess is, when user want to use NCHAR as SHIFT-JIS text, the rest of query consist of either SHIFT-JIS or plain ASCII. If so, what the user need to do is, set the client encoding to SJIFT-JIS and everything should be fine. Maumau, is my guess correct? -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese: http://www.sraoss.co.jp -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers