Re: Debian PostgreSQL 15 pg_createcluster - could not open collator for locale

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Matt Gibbins <matt_gibbins(at)fastmail(dot)com(dot)au>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Debian PostgreSQL 15 pg_createcluster - could not open collator for locale
Date: 2023-03-26 04:30:06
Message-ID: 1970524333.377932.1679805006974@office.mailbox.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On 26/03/2023 00:06 CET Matt Gibbins <matt_gibbins(at)fastmail(dot)com(dot)au> wrote:
>
> The version currently installed as identified from dpkg -l is.
>
> Desired=Unknown/Install/Remove/Purge/Hold
> |
> Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name           Version      Architecture Description
>
> +++-==============-============-============-====================================
> ii  libicu67:amd64 67.1-7       amd64        International Components
> for Unicode
>
> The ls command returns.
>
> lrwxrwxrwx 1 root root       18 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicudata.so.67 -> libicudata.so.67.1
> -rw-r--r-- 1 root root 28407344 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicudata.so.67.1
> lrwxrwxrwx 1 root root       18 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicui18n.so.67 -> libicui18n.so.67.1
> -rw-r--r-- 1 root root  3160560 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicui18n.so.67.1
> lrwxrwxrwx 1 root root       16 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicuio.so.67 -> libicuio.so.67.1
> -rw-r--r-- 1 root root    55456 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicuio.so.67.1
> lrwxrwxrwx 1 root root       18 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicutest.so.67 -> libicutest.so.67.1
> -rw-r--r-- 1 root root    81400 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicutest.so.67.1
> lrwxrwxrwx 1 root root       16 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicutu.so.67 -> libicutu.so.67.1
> -rw-r--r-- 1 root root   211880 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicutu.so.67.1
> lrwxrwxrwx 1 root root       16 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicuuc.so.67 -> libicuuc.so.67.1
> -rw-r--r-- 1 root root  1988784 Jul  1  2021
> /usr/lib/x86_64-linux-gnu/libicuuc.so.67.1
>
> Information obtained from 'apt-cache policy libicu67'.
>
> libicu67:
>   Installed: 67.1-7
>   Candidate: 67.1-7
>   Version table:
>  *** 67.1-7 500
>         500 http://mirror.linux.org.au/debian bullseye/main amd64 Packages
>         100 /var/lib/dpkg/status

Same output as for me.

Would you please build icu-test from the following source and run it with
locale "yue-Hans". Let's see if ucol_open fails with U_INVALID_FORMAT_ERROR
in this case. There are only two functions in Postgres that call ucol_open
and emit error message "could not open collator for locale" for ICU >=54:

initdb.c:check_icu_locale
pg_locale.c:pg_ucol_open (called by pg_import_system_collations)

File icu-test.c:

#include <stdio.h>

#include <unicode/ucol.h>
#include <unicode/uloc.h>

int main(int argc, char** argv) {
if (argc < 2) {
fprintf(stderr, "usage: %s LOCALE\n", argv[0]);
return 1;
}

const char *test_locale = argv[1];

printf("version = %s\n", U_ICU_VERSION);

UErrorCode status = U_ZERO_ERROR;
UCollator *coll = ucol_open(test_locale, &status);
printf("ucol_open\n status = %s\n", u_errorName(status));

if (U_SUCCESS(status)) {
const char *valid_locale = ucol_getLocaleByType(coll, ULOC_VALID_LOCALE, &status);
printf("ucol_getLocaleByType\n status = %s\n locale = %s\n",
u_errorName(status), valid_locale);
}

ucol_close(coll);
}

Build and test:

apt-get install build-essential pkg-config libicu-dev
gcc -o icu-test icu-test.c $(pkg-config --cflags --libs icu-i18n)
./icu-test yue-Hans

I get the following on Debian Bullseye:

version = 67.1
ucol_open
status = U_USING_FALLBACK_WARNING
ucol_getLocaleByType
status = U_USING_FALLBACK_WARNING
locale = zh_Hans

--
Erik

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Matt Gibbins 2023-03-26 08:26:42 Re: Debian PostgreSQL 15 pg_createcluster - could not open collator for locale
Previous Message Matt Gibbins 2023-03-25 23:06:03 Re: Debian PostgreSQL 15 pg_createcluster - could not open collator for locale