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 1rQaU8-002I1m-Py for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jan 2024 22:03:41 +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 1rQaU5-005mkD-FC for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Jan 2024 22:03:37 +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 1rQaU5-005mk5-2B for pgsql-hackers@lists.postgresql.org; Thu, 18 Jan 2024 22:03:37 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rQaU1-002DgJ-G1 for pgsql-hackers@postgresql.org; Thu, 18 Jan 2024 22:03:35 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6db79e11596so165349b3a.0 for ; Thu, 18 Jan 2024 14:03:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1705615412; x=1706220212; 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=+I0AzSYgUQYBleSFx/cUq38FrJe4nL61WUZvDI8/lBI=; b=TSAZCoPdd6Mkm9axHnwoS4t8hEUgKXYOB5k3tYl4yZ5wOVXl8HfxGvPfEV8urJBiQS mkvdZOSiiaj7cNLqzCINKPpxDl61ePL4TKj8GFPoncz43q9V1U+pmwi8ETudY7K+smdB 1FcmanSjgfYKCJ95wTUYCAvvFNVgbRsshCjCiUGWBRs3MY4WYr6OAaPUby3t39vonLco Q5/a8/sOnf0sGtVo2/BhOYlVWeCfjv8iGrQvlvVSzeG2pQW3OD/CPFBcmxtue73POnJ+ 0eGwruViYypZfO4IrfFuwlaXPjOj2rFtmhcRLePWHRc/tdIz0ndNXJfykApyfkgggb1m W++Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705615412; x=1706220212; 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=+I0AzSYgUQYBleSFx/cUq38FrJe4nL61WUZvDI8/lBI=; b=URApeMkIDo2tUC5mnxUbMSNbw+iwXKCo5KMVRgpJkfcz8WLWb1ErdlcNBrfNu9SQjH Ulx2ZiHMCfDpKqgg8yrb015X9ETMZincbO/B3nSRgNJwbM25vozlvrHQ3ADpcYB3Lnb9 kJHaAnjIFuTRf1D1kP/6lwC1FweM5/63CpIbSWjDdxJLrI4sXBRYeNyWo69GNBoSaJ/7 DVglPp2AVkrx8wSx20X/rtLK+o4ZNrVl5zJC0le7KiaOIuwbIuBfOcjhLt6J669SQGZT cGmGkUW4xG8g0tcHjduGlVlI81kt2TIfM/7rQw53WDWM4uwgMxnjJ9CCQsmq0P5ScMw1 HjKA== X-Gm-Message-State: AOJu0Yz83wuY/rovwyLH7LtrqKUzraDGfDUwonVqAkvwVMsrxlgLIMcv 3Ki0FPXaxkldndscTRQzTWSmomQf6FEchcv32f1pu2Z04FFzER7++wbuw5t5OQ== X-Google-Smtp-Source: AGHT+IEl1jEWYW1F9eVO83jrogfkZ0skkqQiRs+SEamYb1aR5w0ASPi1fog2mofH3Kkp/0h6zVJmpg== X-Received: by 2002:a05:6a00:460e:b0:6da:ca4b:8632 with SMTP id ko14-20020a056a00460e00b006daca4b8632mr19769pfb.5.1705615412478; Thu, 18 Jan 2024 14:03:32 -0800 (PST) Received: from [172.18.10.37] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id kt12-20020a056a004bac00b006dbac48633bsm1668323pfb.189.2024.01.18.14.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 14:03:31 -0800 (PST) Message-ID: <3c1f4043bb4f76de78160f8afc8678eaa10b0e46.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: Thu, 18 Jan 2024 14:03:30 -0800 In-Reply-To: <67df0672-5bc0-4b2b-b9e0-00e12bdca601@eisentraut.org> References: <6f3e94c0-f174-4380-9b69-072f8a838881@manitou-mail.org> <12e4f6a78403b33c303c20e44976f891d879be09.camel@j-davis.com> <67df0672-5bc0-4b2b-b9e0-00e12bdca601@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 Thu, 2024-01-18 at 13:53 +0100, Peter Eisentraut wrote: > I think that would be a terrible direction to take, because it would=20 > regress the default sort order from "correct" to "useless". I don't agree that the current default is "correct". There are a lot of ways it can be wrong: * the environment variables at initdb time don't reflect what the users of the database actually want * there are so many different users using so many different applications connected to the database that no one "correct" sort order exists * libc has some implementation quirks * the version of Unicode that libc is based on is not what you expect * the version of libc is not what you expect > =C2=A0 Aside from=20 > the overall message this sends about how PostgreSQL cares about > locales=20 > and Unicode and such. Unicode is primarily about the semantics of characters and their relationships. The patches I propose here do a great job of that. Collation (relationships between *strings*) is a part of Unicode, but not the whole thing or even the main thing. > Maybe you don't intend for this to be the default provider? I am not proposing that this provider be the initdb-time default. > =C2=A0 But then > who would really use it? I mean, sure, some people would, but how > would=20 > you even explain, in practice, the particular niche of users or use > cases? It's for users who want to respect Unicode support text from international sources in their database; but are not experts on the subject and don't know precisely what they want or understand the consequences. If and when such users do notice a problem with the sort order, they'd handle it at that time (perhaps with a COLLATE clause, or sorting in the application). > Maybe if this new provider would be called "minimal", it might > describe=20 > the purpose better. "Builtin" communicates that it's available everywhere (not a dependency), that specific behaviors can be documented and tested, and that behavior doesn't change within a major version. I want to communicate all of those things. > I could see a use for this builtin provider if it also included the=20 > default UCA collation (what COLLATE UNICODE does now). I won't rule that out, but I'm not proposing that right now and my proposal is already offering useful functionality. > There would still be a risk with that approach, since it would=20 > permanently marginalize ICU functionality Yeah, ICU already does a good job offering the root collation. I don't think the builtin provider needs to do so. > I would be curious what your overall vision is here? Vision: * The builtin provider will offer Unicode character semantics, basic collation, platform-independence, and high performance. It can be used on its own or in combination with ICU via the COLLATE clause. * ICU offers COLLATE UNICODE, locale tailoring, case-insensitive matching, and customization with rules. It's the solution for everything from "slightly more advanced" to "very advanced". * libc would be for databases serving applications on the same machine where a matching sort order is helpful, risks to indexes are acceptable, and performance is not important. > =C2=A0 Is switching the=20 > default to ICU still your goal?=C2=A0 Or do you want the builtin provider > to=20 > be the default? It's hard to answer this question while initdb chooses the database default collation based on the environment. Neither ICU nor the builtin provider can reasonably handle whatever those environment variables might be set to. Stepping back from the focus on what initdb does, we should be providing the right encouragement in documentation and packaging to guide users toward the right provider based their needs and the vision outlined above. Regards, Jeff Davis