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 1rO0N6-000M54-Mo for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2024 19:05:45 +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 1rO0N5-00EBm3-Fu for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2024 19:05:43 +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 1rO0N5-00EBlt-1U for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2024 19:05:43 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rO0N2-0013qk-MY for pgsql-hackers@postgresql.org; Thu, 11 Jan 2024 19:05:42 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6dad22e13dcso3870820b3a.3 for ; Thu, 11 Jan 2024 11:05:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1704999938; x=1705604738; 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=82AWc3JO4bICJu1Qfqbn5wtSgWh19+vdQead6uvVjqg=; b=tYX2hJPw2LVeEAHwkSKzk1Y6nM2T+qygblLmwjQ2AWoxZ8sMhAl1clHf7S0YNU4QYL JgSuFzsgX+LksSCezQiWDHu4iohmGVdCGRBVJyjaXIaqy2JRDJUSFRiFaQYbNkMKCrJY 06CBujVJ9hudLOy6+nnCEqN/jw2NV2Ts+0reh56VutYJc9mNXVOYJP0aGd08VSqXH2Kl /EWODdI4AxjwMp/Plr6bW2ZeAVA2QlJEYpVcxiWL6j7I5rSYScuz3lljlezJROGsbbwb zRtlaBslfjErGdGOiKNb6iQuJdc7iG91YwZGy1m8IFQCCQ4v9KIGxqGQdQbte+SD6C+8 VLbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704999938; x=1705604738; 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=82AWc3JO4bICJu1Qfqbn5wtSgWh19+vdQead6uvVjqg=; b=qWbusFUdWis4PMVe3O1x7zJL2fddoCsMW5znsXTV+MYuLw2aEICNhAehzIXn6vQtr0 2xB+EX9BT+sDmqCWxUvC59koIfzmeUzLE/G2D0kwZYZEMhRFApc2bc01nk1t5M8AnQsO 0kSXG/T4KOUsaoRvFjC4mmhjry71fDQA+3kol+Xcrsbh0fHoYEL7z5AeLysuNAVgTG0f dFIz/iIyfVxR+2CB8ap4aDNO86Njv4O1orXiUPhK2NH3l/4Siug7WuZfxU0nFFb6azbN +dcgMJSn5L6mSs5O6nOHMvFgGJYOJXzSddJX2KnykvS2AQG60rBRhBKxLOW3jvPhvX1h 3VHQ== X-Gm-Message-State: AOJu0YxE0o7DSaDOHJh1JXyLa//hDvY7+fPdhZgodsaspUUlF8Nn69bc jgxhW9WA0W6bPmuy5E0OBmRVUuW6wJCi X-Google-Smtp-Source: AGHT+IEmVjohPrB3KHyAtD+H4ZUGJWB7+1wwV1kM9cBwuHO/Klpji0p8JaShmz6EDi4sVd2Ol4n1/w== X-Received: by 2002:a05:6a20:3d01:b0:19a:2432:e487 with SMTP id y1-20020a056a203d0100b0019a2432e487mr302679pzi.121.1704999938367; Thu, 11 Jan 2024 11:05:38 -0800 (PST) Received: from [172.18.10.36] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id hy10-20020a056a006a0a00b006d9b345092dsm1527578pfb.156.2024.01.11.11.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 11:05:37 -0800 (PST) Message-ID: <0f8d5290eb4bcab682e5fb8030ef3e24f6ed60f2.camel@j-davis.com> Subject: Re: Built-in CTYPE provider From: Jeff Davis To: Daniel Verite Cc: Robert Haas , Jeremy Schneider , pgsql-hackers@postgresql.org Date: Thu, 11 Jan 2024 11:05:36 -0800 In-Reply-To: <6f3e94c0-f174-4380-9b69-072f8a838881@manitou-mail.org> References: <6f3e94c0-f174-4380-9b69-072f8a838881@manitou-mail.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 Wed, 2024-01-10 at 23:56 +0100, Daniel Verite wrote: > $ bin/initdb --locale=3DC.UTF-8 --locale-provider=3Dbuiltin -D/tmp/pgdata > =C2=A0 > =C2=A0 The database cluster will be initialized with this locale > configuration: > =C2=A0=C2=A0=C2=A0 default collation provider:=C2=A0 builtin > =C2=A0=C2=A0=C2=A0 default collation locale:=C2=A0=C2=A0=C2=A0 C.UTF-8 > =C2=A0=C2=A0=C2=A0 LC_COLLATE:=C2=A0 C.UTF-8 > =C2=A0=C2=A0=C2=A0 LC_CTYPE:=C2=A0=C2=A0=C2=A0 C.UTF-8 > =C2=A0=C2=A0=C2=A0 LC_MESSAGES: C.UTF-8 > =C2=A0=C2=A0=C2=A0 LC_MONETARY: C.UTF-8 > =C2=A0=C2=A0=C2=A0 LC_NUMERIC:=C2=A0 C.UTF-8 > =C2=A0=C2=A0=C2=A0 LC_TIME:=C2=A0=C2=A0=C2=A0=C2=A0 C.UTF-8 > =C2=A0 The default database encoding has accordingly been set to "UTF8". > =C2=A0 The default text search configuration will be set to "english". >=20 > This is from an environment where LANG=3Dfr_FR.UTF-8 >=20 > I would expect all LC_* variables to be fr_FR.UTF-8, and the default > text search configuration to be "french". You can get the behavior you want by doing: initdb --builtin-locale=3DC.UTF-8 --locale-provider=3Dbuiltin \ -D/tmp/pgdata where "--builtin-locale" is analogous to "--icu-locale". It looks like I forgot to document the new initdb option, which seems to be the source of the confusion. Sorry, I'll fix that in the next patch set. (See examples in the initdb tests.) I think this answers some of your follow-up questions as well. > A related comment is about naming the builtin locale C.UTF-8, the > same > name as in libc. On one hand this is semantically sound, but on the > other hand, it's likely to confuse people. What about using > completely > different names, like "pg_unicode" or something else prefixed by > "pg_" > both for the locale name and the collation name (currently > C.UTF-8/c_utf8)? I'm flexible on naming, but here are my thoughts: * A "pg_" prefix makes sense. * If we named it something like "pg_unicode" someone might expect it to sort using the root collation. * The locale name "C.UTF-8" is nice because it implies things about both the collation and the character behavior. It's also nice because on at least some platforms, the behavior is almost identical to the libc locale of the same name. * UCS_BASIC might be a good name, because it also seems to carry the right meanings, but that name is already taken. * We also might to support variations, such as full case mapping (which uppercases "=C3=9F" to "SS", as the SQL standard requires), or perhaps the "standard" flavor of regexes (which don't count all symbols as punctuation). Leaving some room to name those variations would be a good idea. Regards, Jeff Davis