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 1rG5VH-00DehV-Ff for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Dec 2023 22:57:27 +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 1rG5VD-0002cN-RQ for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Dec 2023 22:57:23 +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 1rG5VD-0002cE-Dq for pgsql-hackers@lists.postgresql.org; Wed, 20 Dec 2023 22:57:23 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rG5VA-00BP3m-KS for pgsql-hackers@postgresql.org; Wed, 20 Dec 2023 22:57:22 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-28b6218d102so160921a91.0 for ; Wed, 20 Dec 2023 14:57:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1703113039; x=1703717839; 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=3pa+tLRUI5ZqzyMs+IHQxpgmsZtdsEXO8qn+7Mc5AYQ=; b=QFVrCXigTZBdy55WMEL6QTaK6LOWtYAWzNAHIzRma9w9nLRUaDWtbUD9hIDDWzjeky GzdUO4UX9nnOEqmpoh6vW5DY2gyTtHlZuoOACqhbcfkAT+rzNY3sgobhFb6W3Kxce6LU n2x00i60P7hUdsij8NSKVHW6vurfyhaN6cs8Zu0igmW4fYzJ8CaV2IzTZmMVytCWDYuw vvNkU9jJiKB9Zc/xplo8W0s/dV52andCRD/1scko86sb1dqpNoh2cEb3gCftdeuw1eTF tMQZ14xWeC5iI/dChp2ePfIzNPYvUgJnpEJmaRlELDuquRavUBSZH33A60CvIDsMNM7C Fyeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703113039; x=1703717839; 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=3pa+tLRUI5ZqzyMs+IHQxpgmsZtdsEXO8qn+7Mc5AYQ=; b=Gcfugz0AqSuQnDzj0Pzt+E0ze3E72YX8bq1qFIUstL9yGDaOjsZ4cngKs4IIcKFsxn bJnyYr1Z+2IDRVBYAFXNEa34uqay6KGhhunOQ1v64WpTKV6q69tc28ectvk2vMcDqf/m jX4BVK5P5nehbyeM6o/dRLYtWdRyWBsvmOmOtKl2eNm8EKx6r9gOckkA8l5L5xgimuqf DGmFrfDOYADs0bH0gl3IRmz3DipgH6+dmLa0U4BcMccnrgTxjePcfzj50ZrF1cLeBx2Q mNFBRX8anH6XOYZuv5ufhz1cMbuf2kANaU65Vr7Fmgqa7UkaAZvPWMHox7cc2/rK0w7E e0YA== X-Gm-Message-State: AOJu0Yy6hfhO0u0V1rcIglw//w7nQrvVwV4eFhqlHzKlOH+0m6mGOsuq nfzf/UftCCnFVfm/VWsSbF4c2A== X-Google-Smtp-Source: AGHT+IEzqawIGjQjq89ujtF0JwCDoVZdZjaJVIBGub3yRSWw7EuYDh91vaRK/3fBIBnehdf7M2/Axg== X-Received: by 2002:a17:90b:238a:b0:28b:e9ef:1979 with SMTP id mr10-20020a17090b238a00b0028be9ef1979mr398586pjb.22.1703113039178; Wed, 20 Dec 2023 14:57:19 -0800 (PST) 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 g10-20020a17090a714a00b0028ad7a2867asm4106402pjs.17.2023.12.20.14.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 14:57:18 -0800 (PST) Message-ID: <90c32479a1f486e5ecad89cb6fe5508d1ae4cfd5.camel@j-davis.com> Subject: Re: Built-in CTYPE provider From: Jeff Davis To: Robert Haas Cc: Daniel Verite , Jeremy Schneider , pgsql-hackers@postgresql.org Date: Wed, 20 Dec 2023 14:57:16 -0800 In-Reply-To: References: 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 Wed, 2023-12-20 at 14:24 -0500, Robert Haas wrote: > This makes sense to me, too, but it feels like it might work out > better for speakers of English than for speakers of other languages. There's very little in the way of locale-specific tailoring for ctype behaviors in ICU or glibc -- only for the 'az', 'el', 'lt', and 'tr' locales. While English speakers like us may benefit from being aligned with the default ctype behaviors, those behaviors are not at all specific to 'en' locales in ICU or glibc. Collation varies a lot more between locales. I wouldn't call memcmp ideal for English ('Zebra' comes before 'apple', which seems wrong to me). If memcmp sorting does favor any particular group, I would say it favors programmers more than English speakers. But that could just be my perspective and I certainly understand the point that memcmp ordering is more tolerable for some languages than others. > Right now, I tend to get databases that default to en_US.utf8, and if > the default changed to C.utf8, then the case-comparison behavior > might > be different en_US.UTF-8 and C.UTF-8 have the same ctype behavior. > For > someone who is currently defaulting to es_ES.utf8 or fr_FR.utf8, a > change to C.utf8 would be a much bigger problem, I would think. Those locales all have the same ctype behavior. It turns out that that en_US.UTF-8 and fr_FR.UTF-8 also have the same collation order -- no tailoring beyond root collation according to CLDR files for 'en' and 'fr' (though note that 'fr_CA' does have tailoring). That doesn't mean the experience of switching to memcmp order is exactly the same for a French speaker and an English speaker, but I think it's interesting. > That might be OK if they don't care about > ordering for any purpose other than equality lookups, but otherwise > it's going to force them to change the default, where today they > don't > have to do that. To be clear, I haven't proposed changing the initdb default. This thread is about adding a builtin provider with builtin ctype, which I believe a lot of users would like. It also might be the best chance we have to get to a reasonable default behavior at some point in the future. It would be always available, fast, stable, better semantics than "C" for many locales, and we can document it. In any case, we don't need to decide that now. If the builtin provider is useful, we should do it. Regards, Jeff Davis