Search code examples
postgresqlpostgislevenshtein-distance

Missing Functions after install of Postgis 2.1


I have taken over a site that I did not build. The database is all messed up, and I am reloading the database from a schema dump file. The database also includes postgis 2.1.

I am using:

  • Postgresql 9.3
  • CentOS 6.5
  • Ruby 1.9.3
  • Ruby on Rails 3

The problem I am having is that the old database has 702 functions in the database for postgis, but my newly created database has only 562 functions. I need some of the missing functions, such as levenstein.

Neither the postgis.sql nor the spatial_ref_sys.sql files include these functions.

How can i install the missing 140 functions? I can not see a way to dump the old functions into a backup without backing up the entire database - but like I said, it is messed up...


Solution

  • Functions like levenstein are included in the fuzzystrmatch module. If you're using Postgres 9.1 or above, you can use CREATE EXTENSION. This answer may also be of some use:

    How do I import modules or install extensions in PostgreSQL 9.1, 9.2, 9.3, 9.4?

    Sadly, it sounds like you'll need to work out which other modules were being used, but Google is your friend there.