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 1pfOYY-0007Gh-Md for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2023 17:16:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pfOYX-0000qu-GG for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2023 17:16:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfOYX-0000ql-2Q for pgsql-hackers@lists.postgresql.org; Thu, 23 Mar 2023 17:16:53 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pfOYR-0001H4-II for pgsql-hackers@postgresql.org; Thu, 23 Mar 2023 17:16:52 +0000 Received: by mail-pj1-x102d.google.com with SMTP id o6-20020a17090a9f8600b0023f32869993so2639301pjp.1 for ; Thu, 23 Mar 2023 10:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20210112.gappssmtp.com; s=20210112; t=1679591807; 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=/AMYXi8iBY+QR0e2pabPcOi2U/mSSh4d5446djyLLzE=; b=79tZ2FqHYYna3bxlCqa8LYrYXX+w3vErp90r/GMxv7jM+1N89HFERUFdZI8FQtKRnX M0eAj5IXDgsfWb3awhMOA9mdIs7cu2Vq7eTCfV4A5QfG2GHNM92L+20AfRoSZXRYzJID W/1Zyjfez1y772cGCS6wxd5kFIpdowqmOlouH9SFJuon3KKWhQ4dt3LTAR2C/wsty8rI 0rOxvBdyQ9tAz4ZN4T0y40j9mSmxak9JYkrnBRX73zFYZWMa4TZKJJ6lJEE5uBtSzGan wkoEphb4ZFRxWiR9h1YWtzuxMbnkuvsIRyvJsC4WFas8Gh6zxideumM9W9xo+lOmIS4k u4Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679591807; 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=/AMYXi8iBY+QR0e2pabPcOi2U/mSSh4d5446djyLLzE=; b=OqyEjLH/PoZ+TgGiJH6mKBzaz8qIQzPX8hNaanKNoopr7fgavgXe8e2yFJX2Tsh1TC 1utDRQ3z5JNICH+lI1haxWlfS5B6PvYO3korrR2/W5OjHFysbAAh8HFFHuMglZ7AqDRd /lyulzRLP8ksUvpXEu4dRHi3BePMTQGubWy6d7lpHXLWD/ORz07+MS0m6ziHAc38lTxM xhwyki+kS46aGfzt/AeI5PVYui2jEG3PyypzRAtBSpY0sEevXkc+jBKnOgxFZ632PJXq dMe06isMkedrjusCI7V5eMa+HRkM8k6tIL1x9heMfrE9atiy1rL0USOWZDlW/uVvhbNj lDwA== X-Gm-Message-State: AO0yUKU2y4J0rWXEq+zqJ3rcrN18RDQlxAigeUQCXBA1f11e3NSamBhH +5nX81ewNTFNaaqXww3f7/JIKA== X-Google-Smtp-Source: AK7set8THwrxvOQ9yjjyvTfNw0o9fYOTwq1zZshdoEGGofADPFwyfpfl8txojnFxOM8HxlvJuuXN1w== X-Received: by 2002:a17:90b:1bc6:b0:23f:aa16:bdd9 with SMTP id oa6-20020a17090b1bc600b0023faa16bdd9mr9015207pjb.44.1679591806672; Thu, 23 Mar 2023 10:16:46 -0700 (PDT) Received: from jeff-laptop.lan (c-73-70-96-208.hsd1.ca.comcast.net. [73.70.96.208]) by smtp.gmail.com with ESMTPSA id n3-20020a654503000000b004fb997a0bd8sm11861287pgq.30.2023.03.23.10.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 10:16:46 -0700 (PDT) Message-ID: <4efdd7bdf9c811e1a32b8d10524bae8040367068.camel@j-davis.com> Subject: Re: ICU locale validation / canonicalization From: Jeff Davis To: Peter Eisentraut , Robert Haas Cc: pgsql-hackers@postgresql.org Date: Thu, 23 Mar 2023 10:16:45 -0700 In-Reply-To: <7ee414ad-deb5-1144-8a0e-b34ae3b71cd5@enterprisedb.com> References: <11b1eeb7e7667fdd4178497aeb796c48d26e69b9.camel@j-davis.com> <33acfc3a772224d668042bd2cbef88e91704ce25.camel@j-davis.com> <6f32de82-88e2-480a-8421-07add8f5dee5@enterprisedb.com> <8c7af6820aed94dc7bc259d2aa7f9663518e6137.camel@j-davis.com> <4eebea80f528b1b5e381d6e834497bd6983e4e93.camel@j-davis.com> <899ab44a-4307-064f-0945-412723d57c02@enterprisedb.com> <857da8b1-2a1e-a2be-7df9-7f5e85a3bcb7@enterprisedb.com> <0d7c4115e3dd3581cec125207cbd72cab677c238.camel@j-davis.com> <1569fa4c-aded-57c4-eb07-3bcf03c5e423@enterprisedb.com> <60da0cecfb512a78b8666b31631a636215d8ce73.camel@j-davis.com> <20a2f13f652e6252531a449508e8a8be31d7664f.camel@j-davis.com> <7d77abd7767baaf30445e83415b428aa3eb54631.camel@j-davis.com> <9afa6dbe0d31053ad265aeba488fde784fd5b7ab.camel@j-davis.com> <7ee414ad-deb5-1144-8a0e-b34ae3b71cd5@enterprisedb.com> 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 Thu, 2023-03-23 at 07:27 +0100, Peter Eisentraut wrote: > So, does uloc_canonicalize() always convert to ICU locale IDs?=C2=A0 What > if=20 > you pass a language tag, does it convert it to ICU locale ID as well? Yes. The documentation is not clear on that point, but my testing shows that it does. And this is only for old versions of the code, so we don't need to worry about later versions of ICU changing that. I thought about using uloc_forLanguageTag(), but the documentation for that is not clear what formats it accepts as an input, so it doesn't seem like a win. If wanted to be paranoid we could use uloc_toLanguageTag() followed by uloc_forLanguageTag(), but that seemed excessive. > >=20 > 0002 and 0003 look ok to me now. Thank you, committed 0002 and 0003. > In 0002, the error "opening default collator is not supported", > should=20 > that be an assert or an elog?=C2=A0 Is it reachable by the user? It's not reachable by the user, but could catch a bug if we accidentally read a NULL field from the catalog or something like that. It seemed a worthwhile check to leave in production builds. > You might want to check the declarations at the top of > pg_ucol_open().=20 > 0003 reformats them after they were just added in 0002.=C2=A0 Maybe check= =20 > that they are pgindent'ed in 0002 properly. They seem to be pgindented fine in 0002, it was unnecessarily reindented in 0003 and I fixed that. I use emacs "align-current" and generally that does the right thing, but I'll rely more on pgindent in the future. > I don't understand patch 0004.=C2=A0 It seems to do two things, handle= =20 > C/POSIX locale specifications and add an SQL-callable function.=C2=A0 Are= =20 > those connected? It's hard to test (or even exercise) the former without the latter. I could get rid of the SQL-callable function and move the rest of the changes into 0006. I'll see if that arrangement works better, and that way we can add the SQL-callable function later (or perhaps not at all if it's not desired). Regards, Jeff Davis