Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres modulus operator on strings

Tags:

sql

postgresql

I run this query on Postgres 9.4 and I don't know why it returns true

SELECT 'Sao Paulo' % 'sao paulu'

Last character is different. Maybe its connected with full text search somehow? Or maybe some type casting is going in the background?

Any suggestions on modulo with strings?

like image 430
Radek Avatar asked Sep 13 '25 08:09

Radek


1 Answers

I've found the answer:

http://www.postgresql.org/docs/9.1/static/pgtrgm.html

text % text boolean Returns true if its arguments have a similarity that is greater than the current similarity threshold set by set_limit.

like image 59
Radek Avatar answered Sep 14 '25 22:09

Radek