Macos PostgreSQL的问题
我正在尝试将pg_trgm模块加载到PostgreSQL,但出现了一些问题:Macos PostgreSQL的问题,macos,postgresql,homebrew,Macos,Postgresql,Homebrew,我正在尝试将pg_trgm模块加载到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
$ 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(通过自制内置)
$ pg_config --sharedir
/usr/local/Cellar/postgresql/9.0.2/share
无法帮助您使用macos,但在debian linux安装中也经常出现同样的问题。这里有一个非常简单的解决方案:所需的库位于一个单独的包中,名为
postgresql contrib
,该包应该附加在主postgresql
包中。重新安装postgresql解决了我的问题。我知道这是一个老问题,但我是通过谷歌发现的,所以其他人也可能在这里结束
在我的Mac OSX macports安装中,我有两个文件夹,其中包含postgresql的.so文件:
/opt/local/lib/postgresql90/
及
似乎我的安装是在/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文件。在生产服务器上,我也这样做了,模块安装成功。在dev机器上,我有contrib文件夹和所需的模块,但它不工作;顺便说一句,在我的OSX 10.7 Lion服务器设置中,要创建的符号链接是:sudo ln-s/opt/local/lib/postgresql90/pg_trgm.so/usr/lib/postgresql/;我通过hotspot找到pg_trm.so,并通过>pg_config--pkglibdir找到.so文件夹(/usr/lib/postgresql)的路径
sudo ln -s /opt/local/lib/postgresql90/pg_trgm.so /usr/local/pgsql-9.0/lib/