【问题标题】:Problem with PostgreSQLPostgreSQL 的问题
【发布时间】:2011-01-11 09:39:59
【问题描述】:

我正在尝试将 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


    【解决方案1】:

    无法帮助您使用 macos,但在 debian-linux 安装中经常会出现同样的问题。一个非常简单的解决方案:所需的库位于一个单独的包中,名为postgresql-contrib,应该另外安装到主postgresql 包中。

    【讨论】:

    • 在生产服务器上我也这样做了,模块安装成功。在开发机器上,我有包含所需模块的 contrib 文件夹,但它不起作用。
    【解决方案2】:

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

    在我的 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 文件。

    【讨论】:

    • 这个答案帮助我解决了同样的问题;顺便说一句,在我的 OSX 10.7 Lion 服务器上设置要创建的符号链接是: sudo ln -s /opt/local/lib/postgresql90/pg_trgm.so /usr/lib/postgresql/ ;我通过热点找到 pg_trm.so 并 > pg_config --pkglibdir 找到 .so 文件夹的路径( /usr/lib/postgresql )
    【解决方案3】:

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

    【讨论】:

      猜你喜欢
      • 2014-06-05
      • 2011-09-29
      • 1970-01-01
      • 2014-08-26
      • 2018-03-09
      • 2013-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多