icu_ext
icu_ext
icu_ext : Access ICU functions
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4240 | icu_ext
|
icu_ext
|
1.10.0 |
UTIL
|
PostgreSQL
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | pgpcre
pg_xenophile
unaccent
gzip
bzip
zstd
http
pg_net
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED
|
1.10.0 |
18
17
16
15
14
|
icu_ext |
- |
| RPM | PIGSTY
|
1.10.0 |
18
17
16
15
14
|
icu_ext_$v |
- |
| DEB | PGDG
|
1.10.0 |
18
17
16
15
14
|
postgresql-$v-icu-ext |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
el8.aarch64
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
el9.x86_64
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
el9.aarch64
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
el10.x86_64
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
el10.aarch64
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
PIGSTY 1.10.0
|
d12.x86_64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
d12.aarch64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
d13.x86_64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
d13.aarch64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
u22.x86_64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
u22.aarch64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
u24.x86_64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
u24.aarch64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
u26.x86_64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
u26.aarch64
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
PGDG 1.10.0
|
Source
pig build pkg icu_ext; # build rpmInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install icu_ext; # install via package name, for the active PG version
pig install icu_ext -v 18; # install for PG 18
pig install icu_ext -v 17; # install for PG 17
pig install icu_ext -v 16; # install for PG 16
pig install icu_ext -v 15; # install for PG 15
pig install icu_ext -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION icu_ext;Usage
Sources: README, datetime docs, v1.10.0 release
icu_ext exposes ICU functionality to PostgreSQL. Upstream requires PostgreSQL 11+ configured with ICU (--with-icu); the pgext catalog tracks version 1.10.0 for PostgreSQL 14-18, with the v1.10.0 release noting PostgreSQL 18 compatibility.
Enable the Extension
CREATE EXTENSION icu_ext;Version Info
SELECT icu_version(); -- ICU library version
SELECT icu_unicode_version(); -- Unicode standard versionLocale Functions
SELECT * FROM icu_locales_list() WHERE name LIKE 'es%' LIMIT 5;
SELECT icu_default_locale();
SELECT icu_set_default_locale('en');Collation Attributes
SELECT * FROM icu_collation_attributes('fr-u-ks-level2-kn');String Comparison
-- Case-sensitive, accent-insensitive comparison:
SELECT icu_compare('abce', 'abce', 'en-u-ks-level1-kc-true'); -- 0
SELECT icu_compare('Abce', 'abce', 'en-u-ks-level1-kc-true'); -- 1Sort Keys and Linguistic Search
CREATE UNIQUE INDEX idx ON my_table((icu_sort_key(name, 'fr-u-ks-level1')));
SELECT icu_strpos('Jean-Rene Dupont', 'jeanrene', 'fr-u-ks-level1-ka-shifted');
SELECT icu_replace('Jean-Rene Dupont', 'jeanrene', '{firstname}', 'fr-u-ks-level1-ka-shifted');Text Boundary Analysis
SELECT * FROM icu_character_boundaries('Hello', 'en');
SELECT * FROM icu_word_boundaries('I like books', 'en');
SELECT * FROM icu_sentence_boundaries('Mr. Smith went home. He was tired.', 'en');
SELECT * FROM icu_line_boundaries('Long text here', 'en');Unicode Normalization and Transformation
SELECT icu_normalize('text', 'NFC');
SELECT icu_is_normalized('text', 'NFC');
SELECT icu_transform('Hello', 'Latin-Cyrillic');
SELECT * FROM icu_transforms_list();Date and Time Localization
SET icu_ext.locale TO '@calendar=buddhist';
SELECT icu_format_date('2020-12-31'::date, '{medium}', 'en@calendar=ethiopic');
SELECT icu_parse_date('25/09/2566', 'dd/MM/yyyy');
SELECT icu_format_datetime(now(), 'GGGG dd/MMMM/yyyy HH:mm:ss.SSS z', 'fr@calendar=buddhist');The datetime docs also define icu_date, icu_timestamptz, and icu_interval, plus the icu_ext.locale, icu_ext.date_format, and icu_ext.timestamptz_format settings used for localized input/output and calendar-aware arithmetic.
Number Spellout
SELECT icu_number_spellout(42, 'en'); -- 'forty-two'
SELECT icu_number_spellout(42, 'fr'); -- 'quarante-deux'Spoof and Confusable Detection
SELECT icu_spoof_check('paypal');
SELECT icu_confusable_strings_check('google', 'gооgle');
SELECT icu_confusable_string_skeleton('phi1');Character Info
SELECT icu_char_name('A');
SELECT icu_char_type('A');
SELECT icu_char_ublock_id('A');
SELECT * FROM icu_unicode_blocks() WHERE block_name = 'Basic_Latin';Caveats
- Functions that depend on ICU collation or Unicode data can change behavior when the linked ICU library changes.
icu_sort_key()is index-friendly, but indexes built on sort keys should be reviewed after ICU upgrades.
Last updated on