Pages

Tuesday, May 13, 2008

postgresql ilike for non latin character

I was having problem with insensitive query of non latin character in postgresql. My postgresql version is 8.2.5, with EUC_JP encoding. However, for temporary solution, I'm using workaround as follows.

Suppose you are having table ABCD with field name: FIELD1 which might contain non latin characters, with database encoding EUC_JP. For example, to search word 'keyword' with ilike in FIELD1, use the following sql:

select * from ABCD where convert(FIELD1 ,'euc_jp','unicode') ilike '%keyword%';

that's all :)

No comments:

Post a Comment