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 1rpbX1-007Wfp-AF for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 22:14: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 1rpbX0-003X9Q-EF for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 22:14: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 1rpbWz-003X6V-VU for pgsql-hackers@lists.postgresql.org; Wed, 27 Mar 2024 22:14:02 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rpbWx-006rLk-8Y for pgsql-hackers@postgresql.org; Wed, 27 Mar 2024 22:14:01 +0000 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-5dbd519bde6so197658a12.1 for ; Wed, 27 Mar 2024 15:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1711577637; x=1712182437; 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=XzZPKeLzRSD0ka/6H3Necnr+vU+4vRFvdRu/1/f0C54=; b=brGaQhS5X6adnYkKsbpDedXOpzL8h96Sr1ck8QdVakYljoazNtS+64PzVAaOOLXS37 Oye+vXz7LDDHSMClHdqRkF8+n7JF+O7EHWq6tjt6Q/wFTwug1RpaXffDPnguf3T5cmMF aAlTBw77yKefliN46rDhKKnhuUdNXStYySCrspl6FkeExf3rGmkqn1GZ1Cekcr1B79gp ODvHRShmky2tFNt8NpS0DCEQrwKKGRijNmmYZ+t/P1eu2ljX7/eI8eae6M+uwHL5WL1H rUPr7ulHrxMiLkmq1r6R4Ei7drgqvrb6We0Or3sx+F5cIxyBPhZTSkthZXjlMaqNGzbI f3pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711577637; x=1712182437; 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=XzZPKeLzRSD0ka/6H3Necnr+vU+4vRFvdRu/1/f0C54=; b=kejx8mVeUNuaVDEq30K5VjkpZ6sY9UmXRIIJ066aREhNjEwLUPqCl+8yoTAW/ssK5i dPl9RVkI6B2FVYXdCBmhiY/wcPQsLIGcEyL+SffRNsoXyL/CDTXuwacCYjZUEStkcURX FydNvLKnG6KNZbhZqAgLT/kpPiT3+LvEeQkFt9KmBAflxx03pL4hZqn/T6mkPVG7RbTW /5aFJ+wCR09PzJKuXxsvSA00R8Tzk5qToU5EWu7pi1hScDZGd9UsgzJQeBKqmLsJZ5wK GDjkB+vZlua2jK7wGy3hVGxFk5mVfTYv+jxDSH7g5vcgOhhyK2xf3xPo2juNZaQFPqYL J+xw== X-Forwarded-Encrypted: i=1; AJvYcCVcvuCsmV8VhCy3afHp7wss9JeSutQvS5gYyVr59krxFpx6gKK0P2dSbtTWiBCoP0ePm86b7bLpYtMwnWsJvHvtcD6KHrKa5DfIYVIk X-Gm-Message-State: AOJu0YyN0N4AChcexZGj4pH0lMv0myFCosaffLDv4pQ/6veM6/HF+/5e PwTW7GpV9nbvyclcbVghojqPyvdDSN59edAYwIqo99piRQjxrR1FdkIBP5xqlw== X-Google-Smtp-Source: AGHT+IGWxPneZPa+cfWylUubC+3rUGRku5f4Qg6gk+qELrMr6YIwLXysZ9PWQYEdJ6gONrwE2Q93dg== X-Received: by 2002:a17:903:22c7:b0:1dd:b728:b890 with SMTP id y7-20020a17090322c700b001ddb728b890mr1188097plg.18.1711577637087; Wed, 27 Mar 2024 15:13:57 -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 b15-20020a170902650f00b001e014627baasm25926plk.79.2024.03.27.15.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 15:13:56 -0700 (PDT) Message-ID: <550302f9fd427f29673fdb99d94f8f64b1ee3d61.camel@j-davis.com> 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, 27 Mar 2024 15:13:55 -0700 In-Reply-To: References: <6f3e94c0-f174-4380-9b69-072f8a838881@manitou-mail.org> <12e4f6a78403b33c303c20e44976f891d879be09.camel@j-davis.com> <612987b5-38fa-44c6-8b78-c0be5a177a70@eisentraut.org> <2692039df6b0cac20c5e488fa0209e8958c5fedb.camel@j-davis.com> <27bb0e52-801d-4f73-a0a4-02cfdd4a9ada@eisentraut.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> 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:04 +0100, Peter Eisentraut wrote: > The patch set v27 is ok with me, modulo (a) discussion about initcap=20 > semantics, and (b) what collation to assign to ucs_basic, which can > be=20 > revisited later. I held off on the refactoring patch for lc_{ctype|collate}_is_c(). There's an explicit "NB: pg_newlocale_from_collation is only supposed to be called on non-C-equivalent locales" comment in DefineCollation(). What I'd like to do is make it possible to create valid pg_locale_t objects out of C locales, which can be used anywhere a real locale can be used. Callers can still check lc_{collate|ctype}_is_c() for various reasons; but if they did call pg_newlocale_from_collation on a C locale it would at least work for the pg_locale.h APIs. That would be a slightly simpler and safer API, and make it easier to do the collation version check consistently. That's not very complicated, but it's a bit invasive and probably out of scope for v17. It might be part of another change I had intended for a while, which is to make NULL an invalid pg_locale_t, and use a different representation to mean "use the server environment". That would clean up a lot of checks for NULL. For now, we'd still like to add the version number to the builtin collations, so that leaves us with two options: (a) Perform the version check in lc_{collate|ctype}_is_c(), which duplicates some code and creates some inconsistency in how the version is checked for different providers. (b) Don't worry about it and just commit the version change in v27- 0001. The version check is already performed correctly on the database without changes, even if the locale is "C". And there are already three built-in "C" collations: "C", "POSIX", and UCS_BASIC; so it's not clear why someone would create even more of them. And even if they did, there would be no reason to give them a warning because we haven't incremented the version, so there's no chance of a mismatch. I'm inclined toward (b). Thoughts? Regards, Jeff Davis