Sample Header Ad - 728x90

Postgres trigram match acting strange for specific characters

3 votes
3 answers
2425 views
I'm using pg_trgm to run a query, but I'm getting a lot of 1 matches when searching with a symbol difference. I have the following query: SELECT my_column, similarity('$ Hello', my_column) AS sml FROM my_table WHERE my_column % '$ Hello' ORDER BY sml DESC, my_column; In my_table, I have the following: - Hello ? Hello | Hello $ Hello ! Hello !? Hello They all return with a similarity match of 1. Do I need to escape the '$' or something similar?
Asked by Lloyd Powell (133 rep)
Jul 8, 2019, 02:54 PM
Last activity: Aug 1, 2023, 06:33 PM