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 1rFkHp-00BnBv-EF for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Dec 2023 00:18:09 +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 1rFkHn-006Y5U-8N for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Dec 2023 00:18:07 +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 1rFkHm-006Y5L-Pl for pgsql-hackers@lists.postgresql.org; Wed, 20 Dec 2023 00:18:06 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rFkHj-00BFOg-60 for pgsql-hackers@postgresql.org; Wed, 20 Dec 2023 00:18:05 +0000 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b9dbbaa9a9so4716017b6e.2 for ; Tue, 19 Dec 2023 16:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1703031482; x=1703636282; 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=8vt0W3Z1tnALb2el23FchXMpUxjZCX0R8lunCgigZ6k=; b=gWbmW8GpyeTLicGhfeOEVrKcrFTs/gC9TNDkAnZPYqziKQ/0Ijpe3Ecm4zQiwegYDL Fp/FIUTt6hHvZkrEfMtmnRDnarNTyoszdJ36iqiLx1fcqAwziLa0wONQYAitNlqhn7rN K5zk9HE9ev/5NjqeKH8Dr3UturPQWuDnGrHnJE/Hw/LzKP0puiDdKm7R/JNGFH9zDvB+ RS+MK3jZPB9B/2F3sY0iTOIYIWlf1+5CQm888K/agawImnutDURo+DOppt84QRRye5/U pD+GQlJcuEdHzlccWPXV4cxT8sqoLXCSZvRvSEYx+6qn5JbUxobIOQGuP/JG1cBvO9L8 2B1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703031482; x=1703636282; 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=8vt0W3Z1tnALb2el23FchXMpUxjZCX0R8lunCgigZ6k=; b=Rxojeapnkom4sOx1TSvIQVKzEewlCrK7qciqvMGsKEhOYT+TizuZh38iS4wsDEClxR EPcWBnxfHRkUhO8lNwDV+HcLpCBGs1B350+58B4vPXisUmaXOG9QZlt0t5rKuG8d8Cil O+5P5Xu3kt+DNT9/NFqQwjCtt7pPK9zIt/6y7P/FHJtdKocKJqaq3VcZunLPoWhbuAGG 5vutTLLsgvvgjXbDpC75LX71nUCFykPeWsKe2KG9AR9rUNPONpHDJHxWB+Ybdu4GNPgn SuVsXHP0lrhCLdX1naMwtrCLsNEQklac1c/1wJKLTwyTM1fPE/dvyoOoknr9jOXMUH4K FNOg== X-Gm-Message-State: AOJu0YxR/Z6BIK/RoOEfyt/dbaqCqeBxjnZXNyLUswLZnEkN3KTTnhh/ TLMVKaiFkcM/LZZixdLtgBszxrN6LFQNUod5kvE= X-Google-Smtp-Source: AGHT+IEEfvu9+Sf1ckMFug+T5k4L8ZEnw8O3ANW2AyFVRLF7Y0ICDMQOxuym3SWVBufk3P8FcOM+Pg== X-Received: by 2002:a05:6358:4403:b0:172:cd62:f1c5 with SMTP id z3-20020a056358440300b00172cd62f1c5mr6484055rwc.33.1703031482474; Tue, 19 Dec 2023 16:18:02 -0800 (PST) Received: from [172.18.10.36] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id f4-20020a17090aec8400b0028bbd9872d5sm2060779pjy.12.2023.12.19.16.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 16:18:02 -0800 (PST) Message-ID: <6682ce676994b18eaa904591cb6618abebe2d3e8.camel@j-davis.com> Subject: Re: Built-in CTYPE provider From: Jeff Davis To: Robert Haas Cc: Jeremy Schneider , pgsql-hackers@postgresql.org Date: Tue, 19 Dec 2023 16:18:01 -0800 In-Reply-To: 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 Tue, 2023-12-19 at 15:59 -0500, Robert Haas wrote: > FWIW, the idea that we're going to develop a built-in provider seems > to be solid, for the reasons Jeff mentions: it can be stable, and > under our control. But it seems like we might need built-in providers > for everything rather than just CTYPE to get those advantages, and I > fear we'll get sucked into needing a lot of tailoring rather than > just > being able to get by with one "vanilla" implementation. For the database default collation, I suspect a lot of users would jump at the chance to have "vanilla" semantics. Tailoring is more important for individual collation objects than for the database-level collation. There are reasons you might select a tailored database collation, like if the set of users accessing it are mostly from a single locale, or if the application connected to the database is expecting it in a certain form. But there are a lot of users for whom neither of those things are true, and it makes zero sense to order all of the text indexes in the database according to any one particular locale. I think these users would prioritize stability and performance for the database collation, and then use COLLATE clauses with ICU collations where necessary. The question for me is how good the "vanilla" semantics need to be to be useful as a database-level collation. Most of the performance and stability problems come from collation, so it makes sense to me to provide a fast and stable memcmp collation paired with richer ctype semantics (as proposed here). Users who want something more probably want the Unicode "root" collation, which can be provided by ICU today. I am also still concerned that we have the wrong defaults. Almost nobody thinks libc is a great provider, but that's the default, and there were problems trying to change that default to ICU in 16. If we had a builtin provider, that might be a better basis for a default (safe, fast, always available, and documentable). Then, at least if someone picks a different locale at initdb time, they would be doing so intentionally, rather than implicitly accepting index corruption risks based on an environment variable. Regards, Jeff Davis