我想在Heroku上的新Postgres 9共享數據庫中使用contrib模塊。更具體而言,pg_trgm和fuzzystrmatch模塊。在documentation它說如何在Heroku Postgres數據庫上啓用contrib模塊
此外,許多免費的附加功能適用,如 fuzzystrmatch,pg_trgm和unaccent。
我似乎無法找到如何真正實現共享Heroku的數據庫上這些模塊的任何文件。 請參閱下面的答案。
注:
我試圖連接到數據庫
heroku pg:psql HEROKU_POSTGRESQL_BROWN
和運行
create extension pg_trgm
create extension fuzzystrmatch
加入他們,但試圖與使用它後
SELECT levenshtein('tests', 'test');
它仍然說
ERROR: function levenshtein(unknown, unknown) does not existLINE 1: SELECT levenshtein('tests', 'test');
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
有人知道爲什麼會這樣?
注意:您必須在postgresql 9.1上才能正常工作。要從舊版本升級,請執行以下操作:dev(https://gist.github.com/2883249),prod(https://devcenter.heroku.com/articles/upgrading-postgres-versions) – jfeust
您可以獲得帶有'echo'的Heroku Postgres上可用擴展的完整列表顯示extwlist.extensions'| heroku pg:psql' https://devcenter.heroku.com/articles/heroku-postgres-extensions-postgis-full-text-search – GregB