16

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

Alex. S.
  • 925

5 Answers5

32

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.

Reichert
  • 466
8

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
joefromct
  • 181
4

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

4

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

create extension fuzzystrmatch;
create extension pg_trgm;
1

Usually with a sql file full of functions, it is something like this:

cat fuzzystrmatch.sql | psql {database name}
jedberg
  • 2,331