postgresql_16:7.1.57.4 Examples
PostgreSQL 16 > Reference > SQL Commands > CREATE COLLATION > Examples
To create a collation from the operating system locale fr_FR.utf8 (assuming the current database encoding is UTF8): CREATE COLLATION french (locale = 'fr_FR.utf8');
To create a collation using the ICU provider using German phone book sort order: CREATE COLLATION german_phonebook (provider = icu, locale = 'de-u-co-phonebk');
To create a collation using the ICU provider, based on the root ICU locale, with custom rules: CREATE COLLATION custom (provider = icu, locale = 'und', rules = '&V << w <<< W'); See (see postgresql_16:4.9.2.3) for further details and examples on the rules syntax.
To create a collation from an existing collation: CREATE COLLATION german FROM "de_DE"; This can be convenient to be able to use operating-system-independent collation names in applications.