Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGr7q-0003CR-WD for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Sep 2013 13:58:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VGr7q-0003ve-8e for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Sep 2013 13:58:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGr7p-0003vS-7O for pgsql-hackers@postgresql.org; Tue, 03 Sep 2013 13:58:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGr7m-0002Hk-7x for pgsql-hackers@postgresql.org; Tue, 03 Sep 2013 13:58:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id r83DwJAM015549; Tue, 3 Sep 2013 09:58:19 -0400 From: Tom Lane To: Heikki Linnakangas cc: "Boguk, Maksym" , pgsql-hackers@postgresql.org Subject: Re: UTF8 national character data type support WIP patch and list of open issues. In-reply-to: <522594E8.2050106@vmware.com> References: <522594E8.2050106@vmware.com> Comments: In-reply-to Heikki Linnakangas message dated "Tue, 03 Sep 2013 10:51:04 +0300" Date: Tue, 03 Sep 2013 09:58:19 -0400 Message-ID: <15548.1378216699@sss.pgh.pa.us> X-Pg-Spam-Score: -4.3 (----) 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 Heikki Linnakangas writes: > On 03.09.2013 05:28, Boguk, Maksym wrote: >> Target usage: ability to store UTF8 national characters in some >> selected fields inside a single-byte encoded database. > I think we should take a completely different approach to this. Two > alternatives spring to mind: > 1. Implement a new encoding. The new encoding would be some variant of > UTF-8 that encodes languages like Russian more efficiently. +1. I'm not sure that SCSU satisfies the requirement (which I read as that Russian text should be pretty much 1 byte/character). But surely we could devise a variant that does. For instance, it could look like koi8r (or any other single-byte encoding of your choice) with one byte value, say 255, reserved as a prefix. 255 means that a UTF8 character follows. The main complication here is that you don't want to allow more than one way to represent a character --- else you break text hashing, for instance. So you'd have to take care that you never emit the 255+UTF8 representation for a character that can be represented in the single-byte encoding. In particular, you'd never encode ASCII that way, and thus this would satisfy the all-multibyte-chars-must-have-all-high-bits-set rule. Ideally we could make a variant like this for each supported single-byte encoding, and thus you could optimize a database for "mostly but not entirely LATIN1 text", etc. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers