Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qo6E6-00097C-Pg for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Oct 2023 18:04:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qo6D6-002Bxk-67 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Oct 2023 18:03:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qo6D5-002Bxb-Cu for pgsql-hackers@lists.postgresql.org; Wed, 04 Oct 2023 18:03:00 +0000 Received: from anastigmatix.net ([68.171.216.17]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qo6Cz-0001DU-L7 for pgsql-hackers@postgresql.org; Wed, 04 Oct 2023 18:02:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=JWeAoS9F/t/IM2cUtMB+WwHhp6fS07PNEyt5dDiGf1k=; b=dlj6KO5aos11EdsyC1seM+Nknt OJRqMlchK5iQPBLdjX2twRQ7QkAy7FFzwK2a0xGfcMab7Kvds+eAu9pSsLajOyQzoP2wzbOmtIWYy 0uE8cu09BriIsLH00Vbt5GivwU45RpFE1OatNU42HuQC17CQo6Be3o2AtLjgdnmaoJgGyUutalIIw /QUh2PjMDeenp8+Q2w5WQe3ZDgiHjoNZNGLoqowvchXOlnAzJI+3xFYvH0BtzhqPFtvExY2z2jsz4 zGNQwIAa0ULI9rMIPF/NEQJlpfFdwxSIoJGggAOz+X3aZFsHVpn/+41rK/subCgRm9Q59nrMi5AbS 6jRNDu7A==; Received: from [::1] (port=58484 helo=adam.ace-host.net) by adam.ace-host.net with esmtpa (Exim 4.96.1) (envelope-from ) id 1qo6Cx-00BNwZ-11; Wed, 04 Oct 2023 14:02:51 -0400 MIME-Version: 1.0 Date: Wed, 04 Oct 2023 14:02:50 -0400 From: Chapman Flack To: Robert Haas Cc: Nico Williams , Jeff Davis , pgsql-hackers@postgresql.org Subject: Re: Pre-proposal: unicode normalized text In-Reply-To: References: User-Agent: Roundcube Webmail/1.6.0 Message-ID: <43864caecd65d02081d623d05ccc1683@anastigmatix.net> X-Sender: chap@anastigmatix.net Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - adam.ace-host.net X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: adam.ace-host.net: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: adam.ace-host.net: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-10-04 13:47, Robert Haas wrote: > On Wed, Oct 4, 2023 at 1:27 PM Nico Williams > wrote: >> A UTEXT type would be helpful for specifying that the text must be >> Unicode (in which transform?) even if the character data encoding for >> the database is not UTF-8. > > That's actually pretty thorny ... because right now client_encoding > specifies the encoding to be used for all data sent to the client. So > would we convert the data from UTF8 to the selected client encoding? The SQL standard would have me able to: CREATE TABLE foo ( a CHARACTER VARYING CHARACTER SET UTF8, b CHARACTER VARYING CHARACTER SET LATIN1 ) and so on, and write character literals like _UTF8'Hello, world!' and _LATIN1'Hello, world!' and have those columns and data types independently contain what they can contain, without constraints imposed by one overall database encoding. Obviously, we're far from being able to do that. But should it become desirable to get closer, would it be worthwhile to also try to follow how the standard would have it look? Clearly, part of the job would involve making the wire protocol able to transmit binary values and identify their encodings. Regards, -Chap