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,我现在得到以下错误。 我会回到2.1.0,但公式似乎不再可用了。 进入2.0试图将Postgres降级到9.2。
关于我还能尝试什么的任何想法都会非常感激吗?
版本:
- PostGres:9.4.5_2
- Postgis:2.2.0
- activerecord_postgis_adapter:3.1.0
- 宝石:0.18
错误如下:
1 2 3 4 5 6 7 8 9 10 11 | 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' |
基本调试:
1 2 3 4 5 | $ 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扩展,并且运行没有打嗝。 当我查找已安装的扩展时:
1 2 3 4 5 | -[ RECORD 36 ]----+--------------------------------------------------------------------- name | postgis default_version | 2.1.7 installed_version | 2.2.0 comment | PostGIS geometry, geography, AND raster spatial types AND functions |
在使用自制程序的OSX上,我通常一起更新
1 2 3 4 5 6 7 8 9 10 | 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)并想要保留您的数据,请首先查看
我遇到了同样的问题,从postgres shell运行
1 2 3 4 5 6 7 | $ \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 |
之后,错误消失了