How to use Postgres with the ICU reference library?

How to use Postgres with the ICU reference library?

Since version 10, Postgres can be configured with ICU, the reference library for Unicode, to use its collations in COLLATE clauses. To that end, ICU collations for most language/countries pairs are automatically created at initdb time (they will be found in pg_catalog.pg_collation), and others can be added later with CREATE COLLATION.

How to check for collation support in PostgreSQL?

To inspect the currently available locales, use the query SELECT * FROM pg_collation, or the command \\dOS+ in psql. For example, the operating system might provide a locale named de_DE.utf8. initdb would then create a collation named de_DE.utf8 for encoding UTF8 that has both LC_COLLATE and LC_CTYPE set to de_DE.utf8.

Is the ICU collation of a given name always the same?

ICU does not support separate “collate” and “ctype” settings, so they are always the same. Also, ICU collations are independent of the encoding, so there is always only one ICU collation of a given name in a database. 23.2.2.1.

Is the name of the collation object the same?

The same collation name may exist for different encodings. A collation object provided by icu maps to a named collator provided by the ICU library. ICU does not support separate “collate” and “ctype” settings, so they are always the same.

What happens when a table is clustered in PostgreSQL?

When a table is clustered, PostgreSQL remembers which index it was clustered by. The form CLUSTER table_name reclusters the table using the same index as before. You can also use the CLUSTER or SET WITHOUT CLUSTER forms of ALTER TABLE to set the index to be used for future cluster operations, or to clear any previous setting.

How are accented letters written in PostgreSQL?

With an implicit Postgres collation: In Unicode, accented letters may be written in composed form in decomposed form, the latter being with an unaccented letter followed by the accent character from the Combining Diacritical Marks Block.