Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prALH-0004aP-Cj for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Apr 2023 04:31:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1prALF-00046M-TW for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Apr 2023 04:31:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prALF-00046C-H3 for pgsql-hackers@lists.postgresql.org; Tue, 25 Apr 2023 04:31:49 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1prALA-004vCV-8r for pgsql-hackers@lists.postgresql.org; Tue, 25 Apr 2023 04:31:48 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1a9253d4551so42870095ad.0 for ; Mon, 24 Apr 2023 21:31:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20221208.gappssmtp.com; s=20221208; t=1682397102; x=1684989102; 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=09ej7IqIdtJ4AHFKT5SSbqFjgOV58VTTCbHgnB3Grv0=; b=183PcNENwKYpmlgQ2dQOe1zsJdqYSSA0fgE3C3lVFV4upfbugXhPuL0+rp2uZWAKIj i4NvdleRIPxMCBaEjSXSQyA5TYYITLLDa03cD7zJL0Q1W/XRgbFCco7RDlFFWVUZmynO A32GUbNdOsWBQnMWYp3fgH6VPo+ulWUbafL52jkeQxtraGgmtmiD2V7gblxZh7p+TLS3 FRsjXYU5g4GOdyNMgOnwUpnGFnxyGY7f2Sy/xj/pQITqft5u/C4xednjfkrBW4Q7SsSc WasxjV5t79IslFwRA4rxKofQJlyHGgXt5Dlm+GeTvpNrVRFdfz/3jp6DuNDghNqoqVzt GcjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682397102; x=1684989102; 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=09ej7IqIdtJ4AHFKT5SSbqFjgOV58VTTCbHgnB3Grv0=; b=QXABM/moarPYYZJWa5nq8IYkWHvnSRr7jzXY6qpaYJ3mV0rAPDlfTSuDfzLbWFMLQb 5WJ+2uKmuzQ8pu9eI7d2/yAKlHQSnRVDzlrQFO4AGRn+LsBkGN77NDP6zkr8etxG+2fe 2i7Mv2qHJAjLmTXGJ2pdd7Qz6WGuHJwQ1AeIUcEeCe+RcBrT+cufI8asuLemxb8TWAmN D1xIgsyMXOOKTMiT8kBQTJg4t+UvpnfVa9YytP+PnyYFv+eJROx/z3lUarIM/N2bSrC1 J+MaHxFpHyT2VRpbCxKo4Hh3UVjb3K0vIWvqF2yIrkihnKuVKUqyj+T0aJLv51wbcCrb T4KA== X-Gm-Message-State: AAQBX9fUpQGuupGgW/JQSb9g1OZ9NMm5His6RLTXyiUJlw8CMry1vGyw aqG0w+QfrPMvxD6KOu2ipG48ig== X-Google-Smtp-Source: AKy350YY/OXJiRJJx6RtZ6a2J+LkHHGFEnjEGA/CcKa0qBkH8IHVE+KFGR2f8Xs8ObL4sdTJQzfYHg== X-Received: by 2002:a17:902:868f:b0:19e:72c5:34df with SMTP id g15-20020a170902868f00b0019e72c534dfmr15762031plo.52.1682397102188; Mon, 24 Apr 2023 21:31:42 -0700 (PDT) Received: from jeff-laptop.lan (c-73-170-46-202.hsd1.ca.comcast.net. [73.170.46.202]) by smtp.gmail.com with ESMTPSA id a8-20020a17090a688800b0024b9257b9b2sm3843246pjd.2.2023.04.24.21.31.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Apr 2023 21:31:41 -0700 (PDT) Message-ID: Subject: Re: Order changes in PG16 since ICU introduction From: Jeff Davis To: Tom Lane Cc: Regina Obe , 'Peter Eisentraut' , 'Sandro Santilli' , pgsql-hackers@lists.postgresql.org Date: Mon, 24 Apr 2023 21:31:40 -0700 In-Reply-To: <3391932.1682107209@sss.pgh.pa.us> References: <000b01d97465$c34bbd60$49e33820$@pcorp.us> <3353947.1682092131@sss.pgh.pa.us> <533d93c5-f604-8e5f-4a48-975c08c53d59@enterprisedb.com> <3365333.1682098091@sss.pgh.pa.us> <002d01d97477$f0395640$d0ac02c0$@pcorp.us> <3367226.1682099185@sss.pgh.pa.us> <003b01d9747a$910471c0$b30d5540$@pcorp.us> <3368986.1682099982@sss.pgh.pa.us> <000001d9747d$066b7560$13426020$@pcorp.us> <3372735.1682101425@sss.pgh.pa.us> <3391932.1682107209@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2023-04-21 at 16:00 -0400, Tom Lane wrote: > I think I might like this idea, except for one thing: you're > imagining > that the locale doesn't control anything except string comparisons. > What about to_upper/to_lower, character classifications in regexes, > etc? If provider=3D'libc' and LC_CTYPE=3D'C', str_toupper/str_tolower are handled with asc_tolower/asc_toupper. The regex character classification is done with pg_char_properties. In these cases neither ICU nor libc is used; it's just code in postgres. libc is special in that you can set LC_COLLATE and LC_CTYPE separately, so that different locales are used for sorting and character classification. That's potentially useful to set LC_COLLATE to C for performance reasons, while setting LC_CTYPE to a useful locale. We don't allow ICU to set collation and ctype separately (it would be possible to allow it, but I don't think there's a huge demand and it's arguably inconsistent to set them differently). > (I'm not sure whether those operations can get redirected to ICU > today > or whether they still always go to libc, but we'll surely want to fix > it eventually if the latter is still true.) Those operations do get redirected to ICU today. There are extensions that call locale-sensitive libc functions directly, and obviously those won't use ICU. > Aside from the user-surprise issues discussed up to now, pg_dump > scripts > emitted by pre-v15 pg_dump are not going to contain LOCALE_PROVIDER > clauses in CREATE DATABASE, and people are going to be very unhappy > if that means they suddenly get totally different locale semantics > after restoring into a new DB. Agreed. > =C2=A0 I think we need some plan for mapping > libc-style locale specs into ICU locales so that we can make that > more nearly transparent. ICU does a reasonable job mapping libc-like locale names to ICU locales, e.g. en_US to en-US, etc. The ordering semantics aren't guaranteed to be the same, of course (because the libc-locales are platform-dependent), but it's at least conceptually the same locale. >=20 > Maybe this means we are not ready to do ICU-by-default in v16. > It certainly feels like there might be more here than we want to > start designing post-feature-freeze. This thread is already on the Open Items list. As long as it's not too disruptive to others I'll leave it as-is for now to see how this sorts out. Right now it's not clear to me how much of this is a v15 issue vs a v16 issue. Regards, Jeff Davis