大网数据广告活动
服务器运维问答

Upgrade PostgreSQL 9.5 to 9.6 with PostGIS - pg_upgrade

· 52CE 我爱测

I'm trying to upgrade a 9.5 server to 9.6, and pg_upgrade gives me the following error: Performing Consistency Checks ----------------------------- Checking cluster versions ok Checking database user is the install user ok Checki…

问题原文

原帖链接 · Jeremy Wilson · CC BY-SA 3.0

I'm trying to upgrade a 9.5 server to 9.6, and pg_upgrade gives me the following error:

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

Which contains:

could not load library "$libdir/rtpostgis-2.2":
ERROR:  could not access file "$libdir/rtpostgis-2.2": No such file or directory

When I start the server and run "CREATE EXTENSION postgis" and then stop the server, pg_upgrade then gives me an error about a non-empty DB:

New cluster database "postgres" is not empty

So, I'm caught in a catch-22 - I can't upgrade without installing the extension, but once I do it considers the database not empty.

Any tips how to fix this?

已采纳解答

原帖链接 · Dan · CC BY-SA 3.0

The problem is that the postgis extension version in the old cluster is not the same as the library version in the new one. So when it tries to migrate the database, it can't find the older version of the extension.

To fix this, for each my_database that has the postgis extension installed, run:

psql my_database postgres -c 'ALTER EXTENSION postgis UPDATE TO "2.3.2";'

in the old cluster. Then run pg_update.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-05-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。