我试图将9.5服务器升级到9.6,并且pg_upgrade给了我以下错误:
Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database user is the install user ok Checking database connection settings ok Checking for prepared transactions ok Checking for reg* system OID user data types ok Checking for contrib/isn with bigint-passing mismatch ok Checking for roles starting with 'pg_' ok Creating dump of global objects ok Creating dump of database schemas ok Checking for presence of required libraries fatal Your installation references loadable libraries that are missing from the new installation. You can add these libraries to the new installation, or remove the functions using them from the old installation. A list of problem libraries is in the file: loadable_libraries.txt
其中包含:
could not load library "$libdir/rtpostgis-2.2": ERROR: could not access file "$libdir/rtpostgis-2.2": No such file or directory
当我启动服务器并运行“CREATE EXTENSION postgis”,然后停止服务器,pg_upgrade然后给我一个关于非空DB的错误:
New cluster database "postgres" is not empty
所以,我陷入了一个catch-22 – 我不能升级没有安装扩展名,但一旦我这样做,认为数据库不是空的。
任何提示如何解决这个问题?
问题是旧集群中的postgis 扩展版本与新版本中的库版本不一样。 所以当它试图迁移数据库时,它找不到旧版本的扩展。
要解决这个问题,对于每个安装了postgis扩展的my_database,运行:
psql my_database postgres -c 'ALTER EXTENSION postgis UPDATE TO "2.3.2";'
在老集群。 然后运行pg_update。
你的9.6安装可能有postgis 2.3和相应的rtpostgis-2.3库。 如果你在9.6安装时有postgis 2.2的libaries,pg_upgrade应该可以正常工作。
如果你需要postgis 2.3,你可能需要pg_dumpall和pg_restore。