Heroku Postgres 问题 "could not access file “$libdir/postgis-2.1"

Issue with Heoku Postgres "could not access file “$libdir/postgis-2.1"

我有一个与 GeoDjango、Postgis 一起工作的项目,并将其部署在 Heroku 中。

我正在使用的一些信息:

在过去的几个月里,当我执行地理编码查询时,每次我想要加载地理信息时,系统都会向我抛出一个错误。

ERROR: could not access file "$libdir/postgis-2.1": No such file or directory

我在网上和 Whosebug 上寻找解决方案,我发现了一些非常接近我的问题,但我尝试了他们的解决方案,但对我不起作用。

我尝试了“ALTER EXTENSION postgis UPDATE”解决方案,但抛出了这个错误:

ERROR: cannot create temporary table within security-restricted operation

我试过“备份你的数据库,删除本地数据库和恢复”但是当我运行命令pg:backups:capture时我得到

An error occurred and the backup did not finish.

当我 运行 pg:backups:info 告诉我这个:

2019-03-02 23:08:31 +0000 pg_dump: [archiver (db)] query failed: ERROR: could not access file "$libdir/postgis-2.1": No such file or directory ... (some database code) 2019-03-02 23:08:31 +0000 waiting for pg_dump to complete 2019-03-02 23:08:31 +0000 pg_dump finished with errors

然后我找到了这个条目 Update PostGIS extensions on Heroku 并发现这与我在使用 heroku postgres 时遇到的问题相同(但作者使用的是 ruby),作者说这得到了 Heroku 支持团队的帮助。好吧,我创建了一张票,发现“免费应用程序的技术支持由在线社区”和 Whosebug 提供,所以我尝试向该用户添加评论,说类似 "hey, can you share the solution please? I have the same problem." 但我没有足够的声望来做。

那我该怎么办?

我找到了解决方法!!!

使用我拥有的旧数据库备份存档,我从 heroku 数据存储部分重置了数据库,然后我使用备份存档(使用 pgAdmin III)恢复了这个问题。

似乎错误与 postgis 版本有关,因为当我遇到问题时我的 postgis 版本是 2.1.8 现在错误解决了我的 postgis 版本是 2.4.4.

希望对大家有用。