无法加载库 /usr/local/lib/postgresql/plpgsql.so .. 未定义符号“MakeExpandedObjectReadOnly”

per*_*ils 3 postgresql freebsd dynamic-loading

我想要做的是转换这个用 bash 编写的webodm ( https://gist.github.com/lkpanganiban/5226cc8dd59cb39cdc1946259c3fea6e ) 的安装脚本,以便在 freenas jail 下的 tcsh shell 中使用。

我现在已经进入了我无法找到解决方案的部分,我希望有人可以启发我下一步该做什么。

触发问题的行是:

su - postgres -c "psql -d webodm_dev -c "\""CREATE EXTENSION postgis;"\"" "
Run Code Online (Sandbox Code Playgroud)

整个错误行:

ERROR:  could not load library "/usr/local/lib/postgresql/plpgsql.so": dlopen (/usr/local/lib/postgresql/plpgsql.so) failed: /usr/local/lib/postgresql/plpgsql.so: Undefined symbol "MakeExpandedObjectReadOnly"
Run Code Online (Sandbox Code Playgroud)

包装信息提供:

postgis24-2.4.5_1              Geographic objects support for PostgreSQL databases
postgresql95-client-9.5.15_2   PostgreSQL database (client)
postgresql95-contrib-9.5.15_2  The contrib utilities from the PostgreSQL distribution
postgresql95-server-9.5.15_2   PostgreSQL is the most advanced open-source database available anywhere
Run Code Online (Sandbox Code Playgroud)

是的,文件存在:

root@webodm2:~ # ls -l /usr/local/lib/postgresql/plpgsql.so
-rwxr-xr-x  1 root  wheel  195119 Feb  7 18:16 /usr/local/lib/postgresql/plpgsql.so
root@webodm2:~ # 
Run Code Online (Sandbox Code Playgroud)

所以有人有一些想法吗?

mam*_*man 6

从 postgres 11 升级到 12 后,我遇到了这个问题,这里是如何为 Linux 和 Mac 修复它(没有 brew)

$ sudo su postgres

$ /usr/lib/postgresql/12/bin/pg_upgrade \
  --old-datadir=/var/lib/postgresql/11/main \
  --new-datadir=/var/lib/postgresql/12/main \
  --old-bindir=/usr/lib/postgresql/11/bin \
  --new-bindir=/usr/lib/postgresql/12/bin \
  --old-options '-c config_file=/etc/postgresql/11/main/postgresql.conf' \
  --new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf' \
Run Code Online (Sandbox Code Playgroud)

您可以添加--check进行干式测试升级,而无需更改 postgres 安装中的任何内容。

对于 brew 安装的 Mac 用户:

升级后运行以下命令”

$ brew postgresql-upgrade-database
Run Code Online (Sandbox Code Playgroud)