Re: pg_trgm

Tatsuo Ishii <ishii@postgresql.org>

From: Tatsuo Ishii <ishii@postgresql.org>
To: teodor@sigaev.ru
Cc: ishii@postgresql.org, pgsql-hackers@postgresql.org
Date: 2010-05-27T11:53:37Z
Lists: pgsql-hackers

Attachments

> It's already multibyte safe since 8.4

No, it doesn't.

$ psql test
Pager usage is off.
psql (8.4.4)
Type "help" for help.

test=# select similarity('abc', 'abd');	-- OK
 similarity 
------------
   0.333333
(1 row)

test=# select similarity('日本語', '日本後');	-- NG
 similarity 
------------
        NaN
(1 row)

test=# select show_trgm('abc');	-- OK
        show_trgm        
-------------------------
 {"  a"," ab",abc,"bc "}
(1 row)

test=# select show_trgm('日本語');	-- NG
 show_trgm 
-----------
 {}
(1 row)

Encoding is EUC_JP, locale is C. Included is the script to reproduce
the problem.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp