PostgreSQL的问题

问题描述 投票:4回答:3

我正在尝试将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": 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 (通过Homebrew安装)

更多信息。

$ pg_config --sharedir
/usr/local/Cellar/postgresql/9.0.2/share
macos postgresql homebrew
3个回答
6
投票

对于macos的问题无法帮助你,但同样的问题经常发生在debian-linux安装上。解决这个问题的方法很简单:所需的库位于一个单独的包中,名为-----------------------。postgresql-contrib,应在主设备上额外安装。postgresql 包。


1
投票

我知道这是个老问题,但我是用Google找到的,所以其他人可能也会在这里结束。

在我的 Mac OSX macports 安装中,我有两个文件夹,分别是postgresql的.so文件。

/opt/local/lib/postgresql90/

/usr/local/pgsql-9.0/lib/

似乎我的安装是在 optlocallibpostgresql90 中,而不是在 usrlocalpgsql-9.0lib 中,所以要安装 pg_trgm,我必须做以下工作。

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

这应该适用于任何不在正确位置的.so文件。


0
投票

重新安装PostgreSQL后,我的问题就解决了。

© www.soinside.com 2019 - 2024. All rights reserved.