how to install fuzzystrmatch.sql pg_trgm.sql on postgresql on mac os x

I have installed postgresql according to this, but I also need fuzzy string match functions, but I have no idea how to install these.


For the Mac, the .sql files are in a folder such as /Library/PostgreSQL/8.3/share/postgresql/contrib


If you are looking for levenshtein or other functions in fuzzystrmatch package in postgresql 9.1, just do this:

# Login with postgres user and:
psql my_database -U postgres
# Enter the postgres password and type in the psql shell:
CREATE EXTENSION fuzzystrmatch;

Done.


If you can't find that extension, it's possible you didn't install postgres contrib.

for instance, on centos style os's:

yum install postgresql93-contrib

Based on the answer here in the context of a Rails migration, all it takes is:

create extension fuzzystrmatch;
create extension pg_trgm;