I’ve got into a situation with PG I’ve never been into before. There is a financial reports table, containing some description of a transaction, with columns like date
, amount
and comment
. And this comment
field is often used to search for something case-insensitively. This is done best using where lower(comment) like '%some words%'
using trigram index:
create index report_comment_lower_trgm on report
using gin (lower(comment) gin_trgm_ops);
But I’ve been looking for one concrete thing and couldn’t find, even though I knew it’s there:
finreport=# select count(*) from report where lower(comment) like '%кредиторськ%';
count
-------
0
Yet, it turns out that just looking for a case-sensitive version works just fine:
finreport=# select count(*) from report where comment like '%Кредиторськ%';
count
-------