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 1pw1xU-0006eo-8F for pgsql-general@arkaria.postgresql.org; Mon, 08 May 2023 14:35:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pw1xS-0005UA-1R for pgsql-general@arkaria.postgresql.org; Mon, 08 May 2023 14:35:22 +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 1pw1xR-0005Te-Mh for pgsql-general@lists.postgresql.org; Mon, 08 May 2023 14:35:21 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pw1xN-001Nc2-D8 for pgsql-general@lists.postgresql.org; Mon, 08 May 2023 14:35:20 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2ac785015d7so51673831fa.1 for ; Mon, 08 May 2023 07:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fortnox.se; s=google; t=1683556515; x=1686148515; h=content-transfer-encoding:content-language:subject:from:to :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=1WffpZ/b0VdkDT76+Tcf49wxAzthvA8dMy4Ek6TnfZU=; b=DfMHyu9axZyCoIIGscCdkGO0BstUTs+bsSuGhzvcGnr0x/+9SPukrLOm3M2wGPfYao SCuW/tXI+9OSUJnWP3Z7wa7nz9Ox+vlWMHRCDCFEscHsffXiYrxPp+N7/Wy03endw2xw u2CBQJuuXts0bdPCbhY/3QLe9amh9hwffImXW4Vtnfdc6dWbFUSlnMoK3RNvvi+iXkSr TaT2C+htLZxDDf0xeBnjkqg3bQ8YfzeR/PYsaBUAEzKZBtjWp72UfLAsk5QGgdyXG3Hl Pamza14BAivf1NmXitPkZ8cM+2H+ZHfYqaQCqQu+f/hNacnb02ejMqKnYgp8Df025mXY mKuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683556515; x=1686148515; h=content-transfer-encoding:content-language:subject:from:to :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=1WffpZ/b0VdkDT76+Tcf49wxAzthvA8dMy4Ek6TnfZU=; b=Tr5rU4Ln6rBgU8vMOMtKqLXDX+/NS7Msxavt3v6gXDBm4d3rnUR/EoxZzsy16zjyoV TzSViqlvG4maupDfXUcZjeT5yTHxX9zMXeTL6Ooz9F2owVp+cYdIwd1bwNwTve9gQ186 PWujvRh3XbJLKgQGGKkv2oAIkapE3fKKaj84K05e9ztxf9Cy08WzuPsp5oRmkN1NLHxe lYesY0lG4gnKg8roWjslMlwtifNXQw8plgp/9s7+Cl8mdYVBe1+D8dPyio89Cm2SfJx6 B3VfaMeN9OfJYbnk/Av5HXbLEH+0OwBJUn4bkTnL3SYEWxfxr+82NqWCvvX35as5ESrd A+2A== X-Gm-Message-State: AC+VfDx6BjvsNliejPQkopJQ5ut1lBN6u9XIpafGCFZvPBpptQIvyds0 kumN+3XxTnp3GJclOiebE5RDrkCvoX0w4KrnDO+JPmB5ejjHDWq0OzMc2A3uoaBbwV1HFtFl+dN lPGeDTBXxX0k/gwj0+cgSBu3RgCSCr4j6s7W0twk= X-Google-Smtp-Source: ACHHUZ6uwSjQKKR+PodIJ/e8qbZvjgwYO2b2N4erYpi+9fnGH874/KlqZvdlkLdg+8PxKagSXq1gTA== X-Received: by 2002:a2e:6a19:0:b0:2ad:936f:a13 with SMTP id f25-20020a2e6a19000000b002ad936f0a13mr977885ljc.30.1683556515537; Mon, 08 May 2023 07:35:15 -0700 (PDT) Received: from [0.0.0.0] (h-217-27-175-130.A147.priv.bahnhof.se. [217.27.175.130]) by smtp.googlemail.com with ESMTPSA id p13-20020a2e9acd000000b002ad8174d025sm848151ljj.122.2023.05.08.07.35.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 May 2023 07:35:15 -0700 (PDT) Message-ID: <2a1de395-c69a-3dae-4459-dbdb633df637@fortnox.se> Date: Mon, 8 May 2023 16:35:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: pgsql-general@lists.postgresql.org From: Oscar Carlberg Subject: ICU, locale and collation question Content-Language: en-US Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, We have a bunch of existing Postgres 10 clusters running on CentOS 7,=20 which have been initialized (initdb) with these collation options; -E 'UTF-8' --lc-collate=3Dsv_SE.UTF-8 --lc-ctype=3Dsv_SE.UTF-8 --lc_monetary=3Dsv_SE.UTF-8 --lc-numeric=3Dsv_SE.UTF-8 --lc-time=3Dsv_SE.UTF-8 --lc-messages=3Den_US.UTF-8 And createdb were provided with these locale options when setting up=20 databases: --lc-collate=3Dsv_SE.UTF-8 --lc-ctype=3Dsv_SE.UTF-8 \l in psql gives: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Name=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 Owner=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= | Encoding | Collate=C2=A0=C2=A0=20 |=C2=A0=C2=A0=C2=A0 Ctype=C2=A0=C2=A0=C2=A0 | ----------------------+--------------------------+----------+-------------+= -------------+ =C2=A0test-db=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | test-user=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | UTF8=C2=A0=C2=A0=C2=A0=C2= =A0 |=20 sv_SE.UTF-8 | sv_SE.UTF-8 | We're upgrading the servers using logical replication, and would like to=20 take the opportunity to switch to ICU rather than relying on glibc, to=20 avoid future problems with index corruption if using physical=20 replication between servers with different versions of glibc. We're trying to figure out the most correct way to configure postgres to=20 achieve this. Currently we have: -E 'UTF-8' --locale-provider=3Dicu --icu-locale=3Dsv-SE-x-icu And createdb are provided with locale options: --lc-collate=3DC --lc-ctype=3DC \l in psql now gives: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Name=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Owner=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | Encoding | Collate=C2=A0=C2=A0 |= =C2=A0=C2=A0=C2=A0=20 Ctype=C2=A0=C2=A0=C2=A0 | ICU Locale=C2=A0 | Locale Provider | ---------------------+---------------------+----------+-------------+------= -------+-------------+-----------------+ =C2=A0test-db=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | test-user=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 | UTF8=C2=A0=C2=A0=C2=A0=C2=A0 | C=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=20 C=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | sv-SE-x-icu= | icu=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 | Is this a safe configuration to avoid index corruption, and other=20 problems, while still being compatible with the previous locale=20 settings? We have done some testing and it appears ORDER BY does sort=20 rows according to Swedish localization in the ICU configured test-db. We're uncertain since this blogpost ->=20 https://peter.eisentraut.org/blog/2022/09/26/icu-features-in-postgresql-15 mentions that there are still some postgres code relying on libc locale=20 facilities. Should we set lc-collate and lc-ctype to sv_SE.UTF-8 when=20 creating databases in addition to the ICU options provided to initdb due=20 to this? Will we still be safe from glibc related corruption as long as=20 --locale-provider=3Dicu --icu-locale=3Dsv-SE-x-icu is set? Best Regards, Oscar --=20 Inneh=C3=A5llet i detta e-postmeddelande =C3=A4r konfidentiellt och avsett = endast f=C3=B6r=20 adressaten.Varje spridning, kopiering eller utnyttjande av inneh=C3=A5llet = =C3=A4r=20 f=C3=B6rbjuden utan till=C3=A5telse av avs=C3=A4ndaren.=C2=A0Om detta medde= lande av misstag=20 g=C3=A5tt till fel adressat v=C3=A4nligen radera det ursprungliga meddeland= et och=20 underr=C3=A4tta avs=C3=A4ndaren via e-post