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 1rFJYr-009JOT-6Y for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Dec 2023 19:45:57 +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 1rFJYp-00CL1G-U3 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Dec 2023 19:45:55 +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 1rFJYp-00CL18-GF for pgsql-hackers@lists.postgresql.org; Mon, 18 Dec 2023 19:45:55 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rFJYm-00CfoU-RT for pgsql-hackers@postgresql.org; Mon, 18 Dec 2023 19:45:54 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6d775f9af42so1371544b3a.3 for ; Mon, 18 Dec 2023 11:45:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1702928750; x=1703533550; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Fj0wqADDw7cCKmy10FK+E2XZqiZIHQkpYGjFs7yeA2s=; b=AKblnVIYFjATMJ1aJVNcSKLORUC6fnMx7CAu6aX1DrA+HkMMUod/qjcZ5i1TiRjfD5 5cL4lPL8WfKux6UNw5PO7kQZkS7y+cJdTBUPhtmJDpBH8ivp+GR2Uy1Fpif1ZoJBk/Yn LH4SLnETg+xkNUnZkfT2QjS9OsLFmMKh8oWfxkZ1F1/MdhDiHRWmwaqawViwVFzNVdY3 /ullnwTeNH9g+TFoDLxaecZCKFFsBzOgwjd+3E2MFfr+oFLKPr7THw1Jxn55MTk6+a6C m/l3wmZJeHLo/sp+jyOQG8xLNbu0UlNSB3H4ns6AC+rbm8Wv4lpoV8DSsvugla7hhaxf 2JPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702928750; x=1703533550; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Fj0wqADDw7cCKmy10FK+E2XZqiZIHQkpYGjFs7yeA2s=; b=t799RbJHCoRnqloBZoi1TPGK2XabAi7wF0s8m2lWVR6QKEMhm3j/EaH3KHsBeS6GM1 bQ6TzBUJ/uSdUQGfbuwOEn0n43W+xyqf1t9kPiinPgA3ocs2Yf4h3AUD95JFbzhBWLNk vrphWclqP3vArU/8V1EJOtBWlueYiIf4/YPNfQfHBlLH4+IIzYBofedZ4wr5gyqveODB l5SahLTxJEIO4+N4OrEPTCEeLizoVlWzKaZheA/5EPZXs7qq8+nzUwN8Gp4GwWZwyLju iUVTxfwLAWxU451iHLP3NtmQNZ5S/CQ/jZworfxj9Y4OXE/fIqkWViaYxSZXRRipMWrT JhpA== X-Gm-Message-State: AOJu0YwfXlwEfP8p9dc44ABiZNsR4paIzQTHhbk5YfmblXb31aoKFuj5 OTg+V7qADAOz02mV7XOGEeO6Ng== X-Google-Smtp-Source: AGHT+IGIPypBF4VI4/pFEYxOn4iVOct8fi3aOvMv3szF5KgtHW+0dfv4gnLxaCsnWOJ1V9dFsWR2TA== X-Received: by 2002:a05:6a00:1a8a:b0:6d9:312a:5fd4 with SMTP id e10-20020a056a001a8a00b006d9312a5fd4mr141448pfv.39.1702928750362; Mon, 18 Dec 2023 11:45:50 -0800 (PST) Received: from [172.18.10.36] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id a21-20020a62e215000000b006d63ace8508sm2979542pfi.70.2023.12.18.11.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 11:45:50 -0800 (PST) Message-ID: Subject: Re: Built-in CTYPE provider From: Jeff Davis To: Jeremy Schneider , pgsql-hackers@postgresql.org Date: Mon, 18 Dec 2023 11:45:46 -0800 In-Reply-To: <578cf85a-1c27-434c-b89e-27a64d8e023a@ardentperf.com> References: <6f3958d8-46a7-4fd1-88de-4d58e84abe0c@ardentperf.com> <578cf85a-1c27-434c-b89e-27a64d8e023a@ardentperf.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 Fri, 2023-12-15 at 16:30 -0800, Jeremy Schneider wrote: > Looking closer, patches 3 and 4 look like an incremental extension of > this earlier idea; Yes, it's essentially the same thing extended to a few more files. I don't know if "incremental" is the right word though; this is a substantial extension of the idea. > the perl scripts download data from unicode.org and > we've specifically defined Unicode version 15.1 and the scripts turn > the > data tables inside-out into C data structures optimized for lookup. > That > C code is then checked in to the PostgreSQL source code files > unicode_category.h and unicode_case_table.h - right? Yes. The standard build process shouldn't be downloading files, so the static tables are checked in. Also, seeing the diffs of the static tables improves the visibility of changes in case there's some mistake or big surprise. > Am I reading correctly that these two patches add C functions > pg_u_prop_* and pg_u_is* (patch 3) and unicode_*case (patch 4) but we > don't yet reference these functions anywhere? So this is just getting > some plumbing in place? Correct. Perhaps I should combine these into the builtin provider thread, but these are independently testable and reviewable. > >=20 > My prediction is that updating this built-in provider eventually > won't > be any different from ICU or glibc. The built-in provider will have several advantages because it's tied to a PG major version: * A physical replica can't have different semantics than the primary. * Easier to document and test. * Changes are more transparent and can be documented in the release notes, so that administrators can understand the risks and blast radius at pg_upgrade time. > Later on down the road, from a user perspective, I think we should be > careful about confusion where providers are used inconsistently. It's > not great if one function follow built-in Unicode 15.1 rules but > another > function uses Unicode 13 rules because it happened to call an ICU > function or a glibc function. We could easily end up with multiple > providers processing different parts of a single SQL statement, which > could lead to strange results in some cases. The whole concept of "providers" is that they aren't consistent with each other. ICU, libc, and the builtin provider will all be based on different versions of Unicode. That's by design. The built-in provider will be a bit better in the sense that it's consistent with the normalization functions, and the other providers aren't. Regards, Jeff Davis