mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-31 10:47:26 +02:00
If the ICU locale is not specified, initialize the default collator and retrieve the locale name from that. Discussion: https://postgr.es/m/510d284759f6e943ce15096167760b2edcb2e700.camel@j-davis.com Reviewed-by: Peter Eisentraut
46 lines
1.3 KiB
SQL
46 lines
1.3 KiB
SQL
|
||
-- unaccent is broken if the default collation is provided by ICU and
|
||
-- LC_CTYPE=C
|
||
SELECT current_setting('lc_ctype') = 'C' AND
|
||
(SELECT datlocprovider='i' FROM pg_database
|
||
WHERE datname=current_database())
|
||
AS skip_test \gset
|
||
\if :skip_test
|
||
\quit
|
||
\endif
|
||
|
||
CREATE EXTENSION unaccent;
|
||
|
||
-- must have a UTF8 database
|
||
SELECT getdatabaseencoding();
|
||
|
||
SET client_encoding TO 'UTF8';
|
||
|
||
SELECT unaccent('foobar');
|
||
SELECT unaccent('ёлка');
|
||
SELECT unaccent('ЁЖИК');
|
||
SELECT unaccent('˃˖˗˜');
|
||
SELECT unaccent('À'); -- Remove combining diacritical 0x0300
|
||
SELECT unaccent('℃℉'); -- degree signs
|
||
SELECT unaccent('℗'); -- sound recording copyright
|
||
|
||
SELECT unaccent('unaccent', 'foobar');
|
||
SELECT unaccent('unaccent', 'ёлка');
|
||
SELECT unaccent('unaccent', 'ЁЖИК');
|
||
SELECT unaccent('unaccent', '˃˖˗˜');
|
||
SELECT unaccent('unaccent', 'À');
|
||
SELECT unaccent('unaccent', '℃℉');
|
||
SELECT unaccent('unaccent', '℗');
|
||
|
||
SELECT ts_lexize('unaccent', 'foobar');
|
||
SELECT ts_lexize('unaccent', 'ёлка');
|
||
SELECT ts_lexize('unaccent', 'ЁЖИК');
|
||
SELECT ts_lexize('unaccent', '˃˖˗˜');
|
||
SELECT ts_lexize('unaccent', 'À');
|
||
SELECT ts_lexize('unaccent', '℃℉');
|
||
SELECT ts_lexize('unaccent', '℗');
|
||
|
||
-- Controversial case. Black-Letter Capital H (U+210C) is translated by
|
||
-- Latin-ASCII.xml as 'x', but it should be 'H'.
|
||
SELECT unaccent('ℌ');
|