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 1sOMdZ-00DozE-O3 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2024 19:24:29 +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 1sOMdX-003pjv-Oj for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2024 19:24:28 +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 1sOMdX-003pjn-BK for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2024 19:24:27 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sOMdQ-004Xp4-H3 for pgsql-hackers@postgresql.org; Mon, 01 Jul 2024 19:24:27 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70abb539f41so1302021b3a.2 for ; Mon, 01 Jul 2024 12:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1719861858; x=1720466658; 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=e/ghqQkmgSZuYYkbDt0MkAzmQpvZr5628nyknZmxiRs=; b=fluy9+w1Ipn3iOIQHqhSsYXvXfAwygP5gILBYCaGtRxbtfb09VOFjNihWW1Ps9/dnR vhLSjCm2/nBG6k/l/nLNcgccDnGtClMZBVg65fDoz9VXOIqbhSGHo9iMbsBQgLdrmEco gcdegRqaR96hfs/u+PKmx2D2mDf6dZKi/zy2raxhgruRVxI2qjEb+NIAXmvERWqXOv5A 2vAGPknGHlfiP/phZRqea1n0ypaYHjVeqDdDgZQUCDGzBzoCgaE89AJp2EU+rMFChOUS eu1Bxeo31ONF7kB3s+OevkeVoogGKNG8qdQk+obyNKD51XWPJ8BNNaHmgZXb0uBCu6sG mc4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719861858; x=1720466658; 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=e/ghqQkmgSZuYYkbDt0MkAzmQpvZr5628nyknZmxiRs=; b=Zw3IDlHCEzN2qAwxDXvi//9USUpqSg8fLJJ+vSFP3I6GXJvF4DpavmbHCbOlW/vcm5 RZ2xEn8WT4Kzs1fkFMLxMTRBagw1PT8flWQ0+lSP8pLLAHkUV9ic6boB1ktb6KLF0JbA XfeiyMhS9/TzRkCQb5f/qD2SSl0KXZStlaeBEk+vwpLT6caGKe1ej8Vf6ap+RkKIyg2N ekqnyp9IDVRgNPUt9sqmevMnKXZs0Y+mjfACtk0k98nfxvWLASo6Jjsuw8UZBrdj1IC/ gvKoAsQwB47C31OpEFO7tvnkMo+hvGmPV3l+TrklHwN/+7cx6+vblGzHTZvxfUeLvDrx e76g== X-Forwarded-Encrypted: i=1; AJvYcCUH0hbgQYxy/+8eUuvBhfDAv5w4pyT4WzmtF/t4jTLJcul0Fq9g+dlOZMBj3OBxl2sLVKF4wbJQ+nQbdKJByUK4firSW7DJiN4Fwxr9 X-Gm-Message-State: AOJu0Yzk2F2beqzwkA07hdDrkAwYMjNm3BHv+v8x1FRbXf4nTOabCuBW ZYcM8NAHw0T2MajWXdDYMutrQCt3aQoMfiI6N9wGXQ67Dg6OHNpXJIQ8p5ff4g== X-Google-Smtp-Source: AGHT+IHUBTeaOhZF1wotiw2TgpzMQ6GaTaV1tehwxCqRw7C8MGT/ZJos+oD63zaj0+bPklssKM9eiQ== X-Received: by 2002:a05:6a20:9144:b0:1bd:2c36:afd6 with SMTP id adf61e73a8af0-1bef60fce4fmr11420357637.2.1719861857538; Mon, 01 Jul 2024 12:24:17 -0700 (PDT) Received: from [172.18.10.46] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac10e3887sm70371985ad.92.2024.07.01.12.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 12:24:16 -0700 (PDT) Message-ID: <1ecfeb4d2b1b7f119fa917d3052a3aecfaf4f425.camel@j-davis.com> Subject: Re: Built-in CTYPE provider From: Jeff Davis To: Noah Misch Cc: Peter Eisentraut , Daniel Verite , Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Date: Mon, 01 Jul 2024 12:24:15 -0700 In-Reply-To: <20240629220857.fb.nmisch@google.com> References: <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> <20240629220857.fb.nmisch@google.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 Sat, 2024-06-29 at 15:08 -0700, Noah Misch wrote: > lower(), initcap(), upper(), and regexp_matches() are > PROVOLATILE_IMMUTABLE. > Until now, we've delegated that responsibility to the user.=C2=A0 The use= r > is > supposed to somehow never update libc or ICU in a way that changes > outcomes > from these functions. To me, "delegated" connotes a clear and organized transfer of responsibility to the right person to solve it. In that sense, I disagree that we've delegated it. What's happened here is evolution of various choices that seemed reasonable at the time. Unfortunately, the consequences that are hard for us to manage and even harder for users to manage themselves. > =C2=A0 Now that postgresql.org is taking that responsibility > for builtin C.UTF-8, how should we govern it?=C2=A0 I think the above tex= t > and [1] > convey that we'll update the Unicode data between major versions, > making > functions like lower() effectively STABLE.=C2=A0 Is that right? Marking them STABLE is not a viable option, that would break a lot of valid use cases, e.g. an index on LOWER(). Unicode already has its own governance, including a stability policy that includes case mapping: https://www.unicode.org/policies/stability_policy.html#Case_Pair Granted, that policy does not guarantee that the results will never change. In particular, the results can change if using unassinged code poitns that are later assigned to Cased characters. That's not terribly common though; for instance, there are zero changes in uppercase/lowercase behavior between Unicode 14.0 (2021) and 15.1 (current) -- even for code points that were unassigned in 14.0 and later assigned. I checked this by modifying case_test.c to look at unassigned code points as well. There's a greater chance that character properties can change (e.g. whether a character is "alphabetic" or not) in new releases of Unicode. Such properties can affect regex character classifications, and in some cases the results of initcap (because it uses the "alphanumeric" classification to determine word boundaries). I don't think we need code changes for 17. Some documentation changes might be helpful, though. Should we have a note around LOWER()/UPPER() that users should REINDEX any dependent indexes when the provider is updated? > (This thread had some discussion[2] that datcollversion/collversion > won't > necessarily change when a major versions changes lower() behavior.) datcollversion/collversion track the vertsion of the collation specifically (text ordering only), not the ctype (character semantics). When using the libc provider, get_collation_actual_version() completely ignores the ctype. It would be interesting to consider tracking the versions separately, though. Regards, Jeff Davis