2011-02-14 09:06:41 +08:00
|
|
|
CREATE EXTENSION unaccent;
|
2009-08-19 00:00:50 +08:00
|
|
|
-- must have a UTF8 database
|
|
|
|
SELECT getdatabaseencoding();
|
|
|
|
getdatabaseencoding
|
|
|
|
---------------------
|
|
|
|
UTF8
|
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SET client_encoding TO 'UTF8';
|
2009-08-18 18:34:39 +08:00
|
|
|
SELECT unaccent('foobar');
|
|
|
|
unaccent
|
|
|
|
----------
|
|
|
|
foobar
|
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SELECT unaccent('ёлка');
|
2009-08-18 18:34:39 +08:00
|
|
|
unaccent
|
|
|
|
----------
|
2019-01-03 01:36:05 +08:00
|
|
|
елка
|
2009-08-18 18:34:39 +08:00
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SELECT unaccent('ЁЖИК');
|
2009-08-18 18:34:39 +08:00
|
|
|
unaccent
|
|
|
|
----------
|
2019-01-03 01:36:05 +08:00
|
|
|
ЕЖИК
|
2009-08-18 18:34:39 +08:00
|
|
|
(1 row)
|
|
|
|
|
2019-01-10 13:10:21 +08:00
|
|
|
SELECT unaccent('˃˖˗˜');
|
|
|
|
unaccent
|
|
|
|
----------
|
|
|
|
>+-~
|
|
|
|
(1 row)
|
|
|
|
|
2019-02-01 22:23:01 +08:00
|
|
|
SELECT unaccent('À'); -- Remove combining diacritical 0x0300
|
|
|
|
unaccent
|
|
|
|
----------
|
|
|
|
A
|
|
|
|
(1 row)
|
|
|
|
|
2009-08-18 18:34:39 +08:00
|
|
|
SELECT unaccent('unaccent', 'foobar');
|
|
|
|
unaccent
|
|
|
|
----------
|
|
|
|
foobar
|
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SELECT unaccent('unaccent', 'ёлка');
|
2009-08-18 18:34:39 +08:00
|
|
|
unaccent
|
|
|
|
----------
|
2019-01-03 01:36:05 +08:00
|
|
|
елка
|
2009-08-18 18:34:39 +08:00
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SELECT unaccent('unaccent', 'ЁЖИК');
|
2009-08-18 18:34:39 +08:00
|
|
|
unaccent
|
|
|
|
----------
|
2019-01-03 01:36:05 +08:00
|
|
|
ЕЖИК
|
2009-08-18 18:34:39 +08:00
|
|
|
(1 row)
|
|
|
|
|
2019-01-10 13:10:21 +08:00
|
|
|
SELECT unaccent('unaccent', '˃˖˗˜');
|
|
|
|
unaccent
|
|
|
|
----------
|
|
|
|
>+-~
|
|
|
|
(1 row)
|
|
|
|
|
2019-02-01 22:23:01 +08:00
|
|
|
SELECT unaccent('unaccent', 'À');
|
|
|
|
unaccent
|
|
|
|
----------
|
|
|
|
A
|
|
|
|
(1 row)
|
|
|
|
|
2009-08-18 18:34:39 +08:00
|
|
|
SELECT ts_lexize('unaccent', 'foobar');
|
|
|
|
ts_lexize
|
|
|
|
-----------
|
|
|
|
|
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SELECT ts_lexize('unaccent', 'ёлка');
|
2009-08-18 18:34:39 +08:00
|
|
|
ts_lexize
|
|
|
|
-----------
|
2019-01-03 01:36:05 +08:00
|
|
|
{елка}
|
2009-08-18 18:34:39 +08:00
|
|
|
(1 row)
|
|
|
|
|
2019-01-03 01:36:05 +08:00
|
|
|
SELECT ts_lexize('unaccent', 'ЁЖИК');
|
2009-08-18 18:34:39 +08:00
|
|
|
ts_lexize
|
|
|
|
-----------
|
2019-01-03 01:36:05 +08:00
|
|
|
{ЕЖИК}
|
2009-08-18 18:34:39 +08:00
|
|
|
(1 row)
|
|
|
|
|
2019-01-10 13:10:21 +08:00
|
|
|
SELECT ts_lexize('unaccent', '˃˖˗˜');
|
|
|
|
ts_lexize
|
|
|
|
-----------
|
|
|
|
{>+-~}
|
|
|
|
(1 row)
|
|
|
|
|
2019-02-01 22:23:01 +08:00
|
|
|
SELECT ts_lexize('unaccent', 'À');
|
|
|
|
ts_lexize
|
|
|
|
-----------
|
|
|
|
{A}
|
|
|
|
(1 row)
|
|
|
|
|