Fix global ICU collations for ICU < 54
authorPeter Eisentraut <peter@eisentraut.org>
Sun, 20 Mar 2022 09:21:45 +0000 (10:21 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sun, 20 Mar 2022 09:21:45 +0000 (10:21 +0100)
commit3a671e1f7cb8b29ad77b08f891b8f22621f490a3
treecbf5c62be3c78836a8d50c81994ab3a740fb0d45
parent3c0c5cc5e65906bad6abe6bb8c2d9f6669870f33
Fix global ICU collations for ICU < 54

createdb() didn't check for collation attributes validity, which has
to be done explicitly on ICU < 54.  It also forgot to close the ICU collator
opened during the check which leaks some memory.

To fix both, add a new check_icu_locale() that does all the appropriate
verification and close the ICU collator.

initdb also had some partial check for ICU < 54.  To have consistent error
reporting across major ICU versions, and get rid of the need to include ucol.h,
remove the partial check there.  The backend will report an error if needed
during the post-boostrap iniitialization phase.

Author: Julien Rouhaud <julien.rouhaud@free.fr>
Discussion: https://www.postgresql.org/message-id/20220319041459.qqqiqh335sga5ezj@jrouhaud
src/backend/commands/dbcommands.c
src/backend/utils/adt/pg_locale.c
src/bin/initdb/Makefile
src/bin/initdb/initdb.c
src/bin/initdb/t/001_initdb.pl
src/include/utils/pg_locale.h
src/test/icu/t/010_database.pl