Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VMM9j-0006yE-Bs for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Sep 2013 18:07:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VMM9i-0003b7-Qo for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Sep 2013 18:07:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VMM9g-0003Z4-L8 for pgsql-hackers@postgresql.org; Wed, 18 Sep 2013 18:07:12 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VMM9b-0008Su-R5 for pgsql-hackers@postgresql.org; Wed, 18 Sep 2013 18:07:12 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 849BA28964; Wed, 18 Sep 2013 11:07:04 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 64A3418496; Wed, 18 Sep 2013 11:07:04 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 9188EC0055; Wed, 18 Sep 2013 11:07:13 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Wed, 18 Sep 2013 11:07:11 -0700 (PDT) Message-ID: <5239EBC4.5030103@vmware.com> Date: Wed, 18 Sep 2013 21:07:00 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Robert Haas CC: MauMau , Tom Lane , "Boguk, Maksym" , "pgsql-hackers@postgresql.org" Subject: Re: UTF8 national character data type support WIP patch and list of open issues. References: <522594E8.2050106@vmware.com> <904.1378304922@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.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 18.09.2013 16:16, Robert Haas wrote: > On Mon, Sep 16, 2013 at 8:49 AM, MauMau wrote: >> 2. NCHAR/NVARCHAR columns can be used in non-UTF-8 databases and always >> contain Unicode data. > ... >> 3. Store strings in UTF-16 encoding in NCHAR/NVARCHAR columns. >> Fixed-width encoding may allow faster string manipulation as described in >> Oracle's manual. But I'm not sure about this, because UTF-16 is not a real >> fixed-width encoding due to supplementary characters. > > It seems to me that these two points here are the real core of your > proposal. The rest is just syntactic sugar. > > Let me start with the second one: I don't think there's likely to be > any benefit in using UTF-16 as the internal encoding. In fact, I > think it's likely to make things quite a bit more complicated, because > we have a lot of code that assumes that server encodings have certain > properties that UTF-16 doesn't - specifically, that any byte with the > high-bit clear represents the corresponding ASCII character. > > As to the first one, if we're going to go to the (substantial) trouble > of building infrastructure to allow a database to store data in > multiple encodings, why limit it to storing UTF-8 in non-UTF-8 > databases? What about storing SHIFT-JIS in UTF-8 databases, or > Windows-yourfavoriteM$codepagehere in UTF-8 databases, or any other > combination you might care to name? > > Whether we go that way or not, I think storing data in one encoding in > a database with a different encoding is going to be pretty tricky and > require far-reaching changes. You haven't mentioned any of those > issues or discussed how you would solve them. I'm not too thrilled about complicating the system for that, either. If you really need to deal with many different languages, you can do that today by using UTF-8 everywhere. Sure, it might not be the most efficient encoding for some characters, but it works. There is one reason, however, that makes it a lot more compelling: we already support having databases with different encodings in the same cluster, but the encoding used in the shared catalogs, for usernames and database names for example, is not well-defined. If we dealt with different encodings in the same database, that inconsistency would go away. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers