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 1rs9wA-005Cry-26 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Apr 2024 23:22:34 +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 1rs9w8-00Ae1T-U3 for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Apr 2024 23:22:32 +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 1rs9t6-00AaE0-KN for pgsql-hackers@lists.postgresql.org; Wed, 03 Apr 2024 23:19:24 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rs9sz-000R5b-Ja for pgsql-hackers@postgresql.org; Wed, 03 Apr 2024 23:19:23 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e27c303573so2544355ad.3 for ; Wed, 03 Apr 2024 16:19:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1712186357; x=1712791157; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=v4qTLQCs48Ec0IcXxrAguH8uH/mCMDlg/JrxsWSPAzY=; b=ugN6FErzWz61222utouY1bMrH9uDMHAAar6f2k7AF7sEJ3LQkiXcDtuYxXXs7HgYrM uIpSVgVpWde/sKgZbaQnyAGre81/SezGVhOI2f6ae0+bWXvXP+FRsx8diQmFiRpoEYay 5jyeN7HcTJ4DW6TmrM8XGnkET7c0VrFgnv+sdNJTOYOia5garV65BdlzkZF3hEACNNPF iQWXF7JtV/B2eXigrrwIc9FJWTwzLTEoQ0WeKtYyhyzRElXM0a0w/6xi77ThFnvlQrav rnBj6lEOPS24EvnQCfuIOV/HH8eWaldcFWLVf9FrB8PlJIVDlCxmMNhkE6WiXjt/zD+2 zI8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712186357; x=1712791157; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=v4qTLQCs48Ec0IcXxrAguH8uH/mCMDlg/JrxsWSPAzY=; b=RzvvHVH2bP1wAjq+uE3y6C5LwOvN8tOQPz7n2m23qN7kLDLgptn5RaQnchxyJqJgDZ A7C/SLz+Skw3mwr1xAakAT/Z9keHZ1QuguTVuQEKmih8EwBzHLxcAIzihuUDToN1K23P Aa8T/XJD8yfR7tvC4qIsMhRU5ztWNn50fo6/mN2CpwIskDKc4oI5FCY7VotXfWIKmHut 1O02qKmhO5U7iLNTIsK5HsVGD9dpg1R7E3yDJbRM6XqJhr4RXCsTguvsGYzWwg5ODBS2 v8kEcKHr/vR1kL1YroXifGpbVTN0Ts5pnbJAiRwuNxwmzNEYG1Zhl8g676tVbm88MopD jrmQ== X-Forwarded-Encrypted: i=1; AJvYcCWA2g0+/j9/qmWkvOEqDoIcJWeIoiMQ1npT+AE1v9uCFXBAmdhFkFbk9u2qi7RfJAMj2QymmO0IMnV1JJeCyEPMAALE2P/ZJfTVnxR3 X-Gm-Message-State: AOJu0YxZwkWAf39lmpAPtGM613HUyJNr4hmHVcapf0XhElWyY4dnYYfM /O8CP7TD4m7ODTVpPuI/GNZ+J+CjV3wHf+VnISgOpiiyN+ivHTrde7WilGyr9A== X-Google-Smtp-Source: AGHT+IEHZT91SdtcdrF6uM8nYLLbGVP/SJEQ47WtBshrlglFmCe28ecTvpAUCAMgiFzTJD0dzepd1A== X-Received: by 2002:a17:902:8ec3:b0:1e2:76ad:cb2 with SMTP id x3-20020a1709028ec300b001e276ad0cb2mr657407plo.15.1712186356726; Wed, 03 Apr 2024 16:19:16 -0700 (PDT) Received: from jeff-laptop.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id x10-20020a170902ec8a00b001dd99fe365dsm13866071plg.42.2024.04.03.16.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 16:19:16 -0700 (PDT) Message-ID: Subject: Re: Built-in CTYPE provider From: Jeff Davis To: Peter Eisentraut , Daniel Verite Cc: Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Date: Wed, 03 Apr 2024 16:19:02 -0700 In-Reply-To: References: <6f3e94c0-f174-4380-9b69-072f8a838881@manitou-mail.org> <4a69d067374d2f6bfb66f5bfb2ab9a020493d49f.camel@j-davis.com> <3bc653b5d562ae9e2838b11cb696816c328a489a.camel@j-davis.com> <163f4e2190cdf67f67016044e503c5004547e5a9.camel@j-davis.com> <6bdb98e68b2b05aa71f7f934e227738eac84ecee.camel@j-davis.com> <19b34a70-f5cf-4faf-88dc-917db44ed48d@eisentraut.org> <846a7e1fa2024918b58ff7583523a2f3de9a11b4.camel@j-davis.com> <3117d30aa911b408b90420f4f280fa0c3b5851be.camel@j-davis.com> <4135cf11-206d-40ed-96c0-9363c1232379@eisentraut.org> <7451f81ba0cb512222ab759de8ca1cffe44e9acb.camel@j-davis.com> <1f309153-8198-4efa-86dd-8c304ec0040c@eisentraut.org> <49f18979-bef5-4cf0-bf3d-8a5ed323f470@eisentraut.org> <69f832595838e40c1b071a5e750665190ba301bf.camel@j-davis.com> <4c9eea58-08a1-4629-a004-439e2cf12de8@eisentraut.org> <1466f20c38f4433c98a950acdaf2c96daf7ce442.camel@j-davis.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2024-03-26 at 08:14 +0100, Peter Eisentraut wrote: >=20 > Full vs. simple case mapping is more of a legacy compatibility > question,=20 > in my mind.=C2=A0 There is some expectation/precedent that C.UTF-8 uses= =20 > simple case mapping, but beyond that, I don't see a reason why > someone=20 > would want to explicitly opt for simple case mapping, other than if > they=20 > need length preservation or something, but if they need that, then > they=20 > are going to be in a world of pain in Unicode anyway. I mostly agree, though there are some other purposes for the simple mapping: * a substitute for case folding: lower() with simple case mapping will work better for that purpose than lower() with full case mapping (after we have casefold(), this won't be a problem) * simple case mapping is conceptually simpler, and that's a benefit by itself in some situations -- maybe the 1:1 assumption exists other places in their application > > There's also another reason to consider it an argument rather than > > a > > collation property, which is that it might be dependent on some > > other > > field in a row. I could imagine someone wanting to do: > >=20 > > =C2=A0=C2=A0=C2=A0 SELECT > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 UPPER(some_field, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 full= =3D> true, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 dotl= ess_i =3D> CASE other_field WHEN ...) > > =C2=A0=C2=A0=C2=A0 FROM ... >=20 > Can you index this usefully?=C2=A0 It would only work if the user query= =20 > matches exactly this pattern? In that example, UPPER is used in the target list -- the WHERE clause might be indexable. The UPPER is just used for display purposes, and may depend on some locale settings stored in another table associated with a particular user. Regards, Jeff Davis