2011-01-11 207 views
4

我試圖加載pg_trgm模塊到PostgreSQL,但出亂子:問題PostgreSQL的

$ psql -d simko_development -f /usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql 
SET 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:9: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:14: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:19: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:24: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:29: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:38: ERROR: function similarity_op(text, text) does not exist 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:44: NOTICE: type "gtrgm" is not yet defined 
DETAIL: Creating a shell type definition. 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:44: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:49: ERROR: type gtrgm does not exist 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:55: ERROR: function gtrgm_in(cstring) does not exist 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:61: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:66: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:71: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:76: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:81: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:86: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:91: ERROR: type gtrgm does not exist 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:105: ERROR: operator does not exist: text % text 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:111: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:116: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:121: ERROR: could not access file "$libdir/pg_trgm": No such file or directory 
psql:/usr/local/Cellar/postgresql/9.0.2/share/contrib/pg_trgm.sql:132: ERROR: operator does not exist: text % text 
  • 的Mac OS X 10.6.6
  • 的PostgreSQL 9.0.2(通過自制insalled)

更多信息:

$ pg_config --sharedir 
/usr/local/Cellar/postgresql/9.0.2/share 

回答

0

重新安裝PostgreSQL總是幫助我。

6

無法幫助您使用macos,但debian-linux安裝中經常會出現同樣的問題。一個解決方案非常簡單:所需的庫位於單獨的軟件包中,名稱爲postgresql-contrib,它應該安裝在主要的postgresql軟件包之外。

+0

在生產服務器上,我也做了這個,模塊安裝成功。在開發機器上,我有需要模塊的contrib文件夾,但它不起作用。 – 2011-01-12 03:27:21

1

我知道這是一個古老的問題,但我發現它使用谷歌,所以其他人也可能最終在這裏。

我的Mac OSX MacPorts的安裝,我有兩個文件夾與PostgreSQL的.so文件:

/opt/local/lib/postgresql90/ 

/usr/local/pgsql-9.0/lib/ 

好像我看了安裝在/ opt/local/lib目錄/ postgresql90 /而不是/usr/local/pgsql-9.0/lib/,所以安裝pg_trgm,我不得不做以下幾點:

sudo ln -s /opt/local/lib/postgresql90/pg_trgm.so /usr/local/pgsql-9.0/lib/ 

這應該適用於任何不在正確位置的.so文件。

+0

這個答案幫助我解決同樣的問題; btw在我的OSX 10.7 Lion Server設置符號鏈接創建是:sudo ln -s /opt/local/lib/postgresql90/pg_trgm.so/usr/lib/postgresql /;我通過hotspot找到pg_trm.so,>> pg_config --pkglibdir找到.so文件夾(/ usr/lib/postgresql)的路徑 – 2012-08-01 20:54:42