问题描述
我正在尝试使用Postgresql 13附带的pg_upgrade将系统从Postgresql 9.6升级到Postgresql13。此升级失败,并显示以下错误:
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
Failure,exiting
-bash-4.2$ cat loadable_libraries.txt
could not load library "$libdir/plpython2": ERROR: could not access file "$libdir/plpython2": No such file or directory
In database: infohub
这个错误对我来说似乎很清楚,infohub数据库使用plpython2扩展名,该扩展名未安装(甚至不存在)用于PostgreSQL 13。
我的问题是我尝试删除扩展名,而pg_upgrade仍然失败,并出现上述错误。
postgres=# \c infohub
psql (13.0,server 9.6.19)
You are now connected to database "infohub" as user "postgres".
infohub=# DROP EXTENSION plpythonu CASCADE ;
DROP EXTENSION
我尝试使用此语句检查是否有任何功能
infohub=# select DISTINCT l.lanname as function_language
from pg_proc p
left join pg_language l on p.prolang = l.oid
;
function_language
-------------------
internal
sql
c
plpgsql
(4 rows)
据我所知,没有依赖于plpythonu(或plpython2)的函数,但是pg_upgrade仍然给我上述有关缺少扩展名的错误。
任何帮助或想法都将不胜感激。
解决方法
在所有数据库中运行以下语句:
SELECT oid::regprocedure
FROM pg_catalog.pg_proc
WHERE probin = '$libdir/plpython2';
然后,您知道哪些功能有故障,可以将其删除。