I have installed postgresql according to this, but I also need fuzzy string match functions, but I have no idea how to install these.
Asked
Active
Viewed 2.7k times
5 Answers
30
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
- 446
- 4
- 3
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
- 1
- 2
4
For the Mac, the .sql files are in a folder such as /Library/PostgreSQL/8.3/share/postgresql/contrib
-
For me, it was in /Library/PostgresPlus/8.3/share/contrib . – Clinton Blackmore Jun 10 '09 at 23:31
3
Based on the answer here in the context of a Rails migration, all it takes is:
create extension fuzzystrmatch;
create extension pg_trgm;
Olivier Lacan
- 131
- 4
1
Usually with a sql file full of functions, it is something like this:
cat fuzzystrmatch.sql | psql {database name}
jedberg
- 2,291
- 22
- 21