pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Matt Gibbins <matt_gibbins@fastmail.com.au>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: Debian PostgreSQL 15 pg_createcluster - could not open collator for locale
Date: Sun, 26 Mar 2023 06:30:06 +0200 (CEST)
Message-ID: <1970524333.377932.1679805006974@office.mailbox.org> (raw)
In-Reply-To: <7429705a-e70f-03d5-9ef3-c60d86d65786@fastmail.com.au>
References: <93809259-173b-9bf0-acb8-d6e0b5c06b87@fastmail.com.au>
	<1684230080.452693.1679762358599@office.mailbox.org>
	<7429705a-e70f-03d5-9ef3-c60d86d65786@fastmail.com.au>

> On 26/03/2023 00:06 CET Matt Gibbins <matt_gibbins@fastmail.com.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





view thread (8+ messages)  latest in thread

Message-ID: <1970524333.377932.1679805006974@office.mailbox.org>
Permalink:  ../1970524333.377932.1679805006974@office.mailbox.org/
Also on:    postgresql.org/message-id/1970524333.377932.1679805006974@office.mailbox.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ewie@ewie.name, matt_gibbins@fastmail.com.au, pgsql-admin@lists.postgresql.org
  Subject: Re: Debian PostgreSQL 15 pg_createcluster - could not open collator for locale
  In-Reply-To: <1970524333.377932.1679805006974@office.mailbox.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox