【问题标题】:Issues with Postgis 2.2.0 and Postgres 9.4.5: PG::UndefinedFile - ERROR: could not access file "$libdir/postgis-2.1"Postgis 2.2.0 和 Postgres 9.4.5 的问题:PG::UndefinedFile - 错误:无法访问文件“$libdir/postgis-2.1”
【发布时间】:2016-02-23 18:40:09
【问题描述】:

不幸的是,我通过自制软件将 postgis 升级到 2.2.0,现在出现以下错误。我会回到 2.1.0,但该公式似乎不再可用。转到 2.0 会尝试将 Postgres 降级到 9.2。

任何关于我还能尝试什么的想法将不胜感激?

版本:

  • PostGres:9.4.5_2
  • Postgis:2.2.0
  • activerecord_postgis_adapter: 3.1.0
  • pg 宝石:0.18

以下错误:

PG::UndefinedFile - ERROR:  could not access file "$libdir/postgis-2.1": No such file or directory
:
  activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in `block in exec_no_cache'
  activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
  activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activerecord (4.2.4) lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
  activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:596:in `exec_no_cache'
  activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:588:in `execute_and_clear'
  activerecord (4.2.4) lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query'
  activerecord (4.2.4) lib/active_record/connection_adapters/postgresql_adapter.rb:737:in `column_definitions'
  activerecord-postgis-adapter (3.1.0) lib/active_record/connection_adapters/postgis/schema_statements.rb:9:in `columns'

基本调试:

$ pg_config --pkglibdir                                        
/usr/local/Cellar/postgresql/9.4.5/lib

$ ls -lrt /usr/local/Cellar/postgresql/9.4.5/lib/postgis
postgis-2.1.so*

/usr/local/Cellar/postgresql/ 仍然显示 9.4.5_1 和 9.4.5_2 的文件夹。我还尝试在 Postgres 上删除、创建和更改 postgis 扩展,并且运行时不会出现问题。当我寻找已安装的扩展时:

-[ RECORD 36 ]----+---------------------------------------------------------------------
name              | postgis
default_version   | 2.1.7
installed_version | 2.2.0
comment           | PostGIS geometry, geography, and raster spatial types and functions

【问题讨论】:

  • Postgres.app (9.4.5) 捆绑 PostGIS (2.1.8) 和 Just Works™。我必须承认,当我也不得不开始处理 PostGIS 时,我放弃了自己安装 Postgres。如果你还想升级的话,他们好像有 9.5beta2/2.2.0。

标签: postgresql postgis postgresql-9.4 rgeo


【解决方案1】:

在带有自制软件的 OSX 上,我通常将 postgresqlpostgis 一起更新如下:

brew update
brew uninstall postgis
brew upgrade postgresql
brew install postgis

# update the postgis extension 
psql -d your_database -c "alter extension postgis update"

# recompile the native extensions in the pg gem
gem pristine pg

如果您正在对 PostgreSQL 进行重大更新(例如,从 9.4 到 9.5)并希望保留您的数据,请首先查看 pg_upgrade

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,从 postgres shell 运行 ALTER EXTENSION postgis UPDATE; 似乎可以解决问题:

    $ \dx  postgis                
    | 2.1.7   | public     | PostGIS geometry, geography, and raster spatial types and functions
    $ ALTER EXTENSION postgis UPDATE; 
    ALTER EXTENSION
    
    $ \dx postgis                
    | 2.2.0   | public     | PostGIS geometry, geography, and raster spatial types and functions
    

    之后,错误消失了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-16
      • 2013-04-21
      • 2011-03-23
      • 2019-05-30
      相关资源
      最近更新 更多