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 1qygLA-00ADGN-31 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Nov 2023 22:39:04 +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 1qygL8-00Fx9J-Od for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Nov 2023 22:39:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qygL8-00Fx9B-5b for pgsql-hackers@lists.postgresql.org; Thu, 02 Nov 2023 22:39:02 +0000 Received: from crocodile.elm.relay.mailchannels.net ([23.83.212.45]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qygL0-004OWA-Dg for pgsql-hackers@postgresql.org; Thu, 02 Nov 2023 22:39:01 +0000 X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C68558407DC; Thu, 2 Nov 2023 22:38:51 +0000 (UTC) Received: from pdx1-sub0-mail-a250.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0C60D840655; Thu, 2 Nov 2023 22:38:51 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1698964731; a=rsa-sha256; cv=none; b=+UVdlx5gEUjowAesqEi+L277yyMJNYRX7PIYqohWVbz2wCTiFhjZPS0tBXQAk8xEo6HmfX QZKSt58ppIo5jzzRQ3Q2AQvrTPgiYPlSDY2TpvxJEPZUlBagp/S/Y90YjmwMcEj+TRwptY IFlv7SRkPR34/K4ljXYFJIfRv5TZM5o7tWjRoMeVcdF9i/yD8yyd1PbmOtd+SaVQwr7/tg OSs9BV7tkLlFXl/BO3skCIwS/KrUtIiME3FSloxSGq3b9SSzFmtlWLPDbS9Bl5l4/inlny 15OR+QANBhfD0WdzFf8MnegM/dD1rQRfBmz7zvkUawMn9OVWttJpJgCMldD/9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1698964731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rrr69qzrA8ZZGxDOXPiy/6JW8ypssNimKt8BZOj9I74=; b=E0UI0gfcoUyNlNwFTrF6cfiRvXx/NJctAGi4cYz9f1sCa9RP2aP5OitwODvTuwEQegnxy0 UbUCU5bVyWTLAvFVh2HEVFuSuM0LMBI3mMwemQikAZbjP/ffhfXn8shWWaC6kqlbldpEpi JGtwpbshkf8NhuouIkAQH0QLoHGhXtkQCZ1nveoIfab666yym7nHctDx+mTt91fpsu+7qL 10+oZKIvuFZW0FZiVe93mp9K7Hy75rB8+ZBheQ0xQFDqxqoq5ewRM8N33sE3FokzbXJwlT o7//SN6vkwESg0cZFTH9PiWmtZ3f8cQrMMBQM05i+9QJQ88y/uKfAmCgbWQexA== ARC-Authentication-Results: i=1; rspamd-79d8cddc67-xnmls; auth=pass smtp.auth=dreamhost smtp.mailfrom=nico@cryptonector.com X-Sender-Id: dreamhost|x-authsender|nico@cryptonector.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|nico@cryptonector.com X-MailChannels-Auth-Id: dreamhost X-Drop-Battle: 6d552f0178cc9408_1698964731560_3448714703 X-MC-Loop-Signature: 1698964731560:3316346910 X-MC-Ingress-Time: 1698964731559 Received: from pdx1-sub0-mail-a250.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.123.68.18 (trex/6.9.2); Thu, 02 Nov 2023 22:38:51 +0000 Received: from ubby21 (075-081-095-064.res.spectrum.com [75.81.95.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nico@cryptonector.com) by pdx1-sub0-mail-a250.dreamhost.com (Postfix) with ESMTPSA id 4SLzLf1v2Gz6y; Thu, 2 Nov 2023 15:38:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptonector.com; s=dreamhost; t=1698964730; bh=rrr69qzrA8ZZGxDOXPiy/6JW8ypssNimKt8BZOj9I74=; h=Date:From:To:Cc:Subject:Content-Type; b=kM90fTVNdhL6qiZ5UcE4bJf8V58gs7spVHDWQIXeIE4b8DVdnsN+69mt+cKxxoYgS GuZVOpDsz9Eq8iT8jwhk/3CetrB2TCjWK8OHKubkppz1Cr9ftbzinUFzFxpovuLPgp 8bm30TbxRWiufFCOEXF1LHmLLN0f3nZePqv2yPH+3sPO1dtRomnmfQD85hq2V+IXZO pvEfCVHVPfB+dyZLt0Qgqb2mY6RTD1XcMFARD+lI4KP8AneV8PUh78bs4YwDnj+b/K dEzbAwkpLeEdPJcojcY3eoryhcnJ3BuZvEeorJbKjgnLU4P6yP5appqmlIkiVa7R/+ ZVn3Xkwls31og== Date: Thu, 2 Nov 2023 17:38:47 -0500 From: Nico Williams To: Robert Haas Cc: Isaac Morland , Jeff Davis , Chapman Flack , pgsql-hackers@postgresql.org Subject: Re: Pre-proposal: unicode normalized text Message-ID: References: <94a0e631b787d56fec1b17e03fe045b5e14907c1.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Oct 06, 2023 at 02:37:06PM -0400, Robert Haas wrote: > > Sure, because TEXT in PG doesn't have codeset+encoding as part of it -- > > it's whatever the database's encoding is. Collation can and should be a > > porperty of a column, since for Unicode it wouldn't be reasonable to > > make that part of the type. But codeset+encoding should really be a > > property of the type if PG were to support more than one. IMO. > > No, what I mean is, you can't just be like "oh, the varlena will be > different in memory than on disk" as if that were no big deal. It would have to be the same in memory as on disk, indeed, but you might need new types in C as well for that. > I agree that, as an alternative to encoding being a column property, > it could instead be completely a type property, meaning that if you > want to store, say, LATIN1 text in your UTF-8 database, you first > create a latint1text data type and then use it, rather than, as in the > model I proposed, creating a text column and then applying a setting > like ENCODING latin1 to it. I think that there might be some problems Yes, that was the idea. > with that model, but it could also have some benefits. [...] Mainly, I think, whether you want PG to do automatic codeset conversions (ugly and problematic) or not, like for when using text functions. Automatic codeset conversions are problematic because a) it can be lossy (so what to do when it is?) and b) automatic type conversions can be surprising. Ultimately the client would have to do its own codeset conversions, if it wants them, or treat text in codesets other than its local one as blobs and leave it for a higher app layer to deal with. I wouldn't want to propose automatic codeset conversions. If you'd want that then you might as well declare it has to all be UTF-8 and say no to any other codesets. > But, even if we were all convinced that this kind of feature was good > to add, I think it would almost certainly be wrong to invent new > varlena features along the way. Yes. Nico --