【问题标题】:Postgresql Update Causes: 'django.db.utils.OperationalError: could not access file "$libdir/postgis-2.4": No such file or directory'Postgresql 更新原因:'django.db.utils.OperationalError: could not access file "$libdir/postgis-2.4": No such file or directory'
【发布时间】:2019-02-28 13:49:56
【问题描述】:

我们在 OSX 实例上运行的 Django 项目在使用 brew 意外升级后出现问题。

以前,Django 系统运行 postgresql-9.5 和 postgis-2.3 并且没有问题。

但是,一旦 brew 安装了 postgresql 10.5 版和 postgis 2.5,一切都开始崩溃了。

在此更新之后,我们在尝试在 Django 中运行数据库查询时收到以下错误:

django.db.utils.OperationalError: could not access file "$libdir/postgis-2.4": No such file or directory

当进入 psql 以尝试通过运行将扩展名扩展到 2.4 时:

ALTER EXTENSION postgis UPDATE TO "2.4.0";

我们得到错误:

ERROR: extension "postgis" has no update path from version "2.5.0" to version "2.4.0"

我们在使用 brew 重新安装 postgresql 9.5 和 postgis 2.3 时未能成功,并且不确定下一步该去哪里尝试让开发系统运行。

寻找有关如何让 Django 实例查找我猜现在存在的扩展 2.5 或通过 brew 在 mac 上将 postgres 系统返回到它以前的状态的建议。

Django 2.0.1 版和 psycopg2 2.7.3.2 版

更新

不幸的是,到目前为止唯一有效的解决方案是在gis Stack Exchange: 上遵循 n1000 的答案,这基本上是

  1. 创建数据的 pg_dump

    pg_dump -h HOST_URL --user USER --password --column-inserts --data-only -T 'topology.topology' -t 'public.*' DATABASE_NAME_ON_THE_POSTGRES_SERVER -O -x > local.sql

  2. 删除本地数据库

  3. 在 psql 上运行更新脚本

    ALTER EXTENSION postgis UPDATE;

  4. 从之前创建的 pd_dump 中恢复数据

    psql -U postgres DATABASE < local.sql

【问题讨论】:

    标签: python django postgresql homebrew postgis


    【解决方案1】:

    运行 Arch Linux、Rails 5.2、PostgreSQL 10.5、Postgis 2.4.4-4。今天(2018 年 10 月 1 日)进行了系统更新,并更新了相关的 Postgis 库,即 postgis、gdal、geos 和 proj。尝试查询启用 postgis 的数据库时立即遇到相同的错误:could not access file "$libdir/postgis-2.4"

    解决方案是简单地打开一个psql 控制台并更新postgis 扩展。

    psql -d <name_of_database>
    ALTER EXTENSION postgis UPDATE;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-05
      • 2016-11-01
      • 1970-01-01
      • 2020-03-19
      相关资源
      最近更新 更多