我从postgresql 9.3升级到9.4,现在我想迁移我的数据.
所以这就是我试图做的.首先我像这样运行旧的postgresql
/opt/pgsql-9.3/bin/pg_ctl -D /var/lib/postgres/data/ start
/opt/pgsql-9.3/bin/pg_dumpall >> old_backup.sql
它告诉我:
pg_dump: [archiver (db)] query Failed: ERROR: could not access file "$libdir/postgis-2.1": No such file or directory
好吧,我试图找到postgis-2.1文件并将它们复制到libdir
find / -name "*postgis-2.1*"
/usr/lib/postgresql/rtpostgis-2.1.so
/usr/lib/postgresql/postgis-2.1.so
/usr/lib/postgresql/postgis-2.1 <-----
好的,现在什么是libdir?
/opt/pgsql-9.3/bin/pg_config --pkglibdir
/opt/pgsql-9.3/lib
所以我在/opt/pgsql-9.3/lib中创建了一个符号链接到这里/usr/lib/postgresql/postgis-2.1:
pwd
/opt/pgsql-9.3/lib
ls -l postgis-2.1
postgis-2.1 -> /usr/share/postgresql/contrib/postgis-2.1
但我仍然得到错误:查询失败:错误:无法访问文件“$libdir / postgis-2.1”:没有这样的文件或目录
我有点想法.也许有人可以帮助我?
我是usnig arch linux
P.S
Postgis已安装:
pacman -S postgis
warning: postgis-2.1.5-1 is up to date -- reinstalling
以下是二进制文件:
find / -name "*postgis-2.1*"
/usr/lib/postgresql/rtpostgis-2.1.so <---- binary
/usr/lib/postgresql/postgis-2.1.so <----- binary
/opt/pgsql-9.3/lib/postgis-2.1 <----- that's the symlink from earlier
/usr/share/postgresql/contrib/postgis-2.1
最佳答案
符号链接指向“共享”文件,用于CREATE EXTENSION和family.你需要的是将.so文件指向pg_config –pkglibdir返回的目录:
$rm /opt/pgsql-9.3/lib/postgis-2.1 # it is a wrong link,so undo it
$ln -s /usr/lib/postgresql/postgis-2.1.so /opt/pgsql-9.3/lib/
现在PostGIS .so文件将在“$libdir”中,您将能够执行pg_dumpall.
当然保持这种方式不会让我理智,但是作为你的升级,我假设这只是一个中间状态,你将完全删除Postgresql 9.3.您还必须验证PostGIS是否与9.3库链接,否则您可能会遇到一些问题.