我尝试将plpython3扩展添加到我的timescaledb/postgres (基于linux高山)映像中:
FROM timescale/timescaledb:0.9.0-pg10
RUN set -ex \
&& apk add --no-cache --virtual .plpython3-deps --repository http://nl.alpinelinux.org/alpine/edge/testing \
postgresql-plpython3当我尝试创建扩展时,我会得到以下错误:
postgres=# CREATE EXTENSION plpython3u;
ERROR: could not open extension control file "/usr/local/share/postgresql/extension/plpython3u.control": No such file or directory但是,当我搜索容器中的文件时,我可以在另一个目录中找到它们:
/ # find / -name '*plpy*'
/usr/lib/postgresql/plpython3.so
/usr/share/postgresql/extension/plpython3u.control
/usr/share/postgresql/extension/plpython3u--1.0.sql
/usr/share/postgresql/extension/plpython3u--unpackaged--1.0.sql如何将postgresql-plpython3安装到不同的目录或配置postgres以识别我添加的扩展?
更新
当我只是将文件mv到/usr/local/share/postgresql/extension时,我得到了错误:
postgres=# CREATE EXTENSION plpython3u;
ERROR: could not access file "$libdir/plpython3": No such file or directory更新2
因此,$libdir的问题是,pg_config --pkglibdir指向/usr/local/lib/postgresql,而plpython3.so在/usr/lib/postgresql中。当我将所有内容移动到相应的/usr/local目录时,我可以成功地创建扩展。
这就引出了我希望在哪里找到答案的问题。如何将postgresql-plpython3安装到/usr/local/...而不是/usr/...
发布于 2019-04-04 11:45:52
我相当肯定,如果您使用预先构建的包,您将被硬编码的安装路径所困。
解决问题的最简单方法是在安装后创建符号链接:
FROM timescale/timescaledb:0.9.0-pg10
RUN set -ex \
&& apk add --no-cache --virtual .plpython3-deps --repository http://nl.alpinelinux.org/alpine/edge/testing \
postgresql-plpython3 \
&& ln -s /usr/lib/postgresql/plpython3.so /usr/local/lib/postgresql/plpython3.so \
&& ln -s /usr/share/postgresql/extension/plpython3u.control /usr/local/share/postgresql/extension/plpython3u.control \
&& ln -s /usr/share/postgresql/extension/plpython3u--1.0.sql /usr/local/share/postgresql/extension/plpython3u--1.0.sql \
&& ln -s /usr/share/postgresql/extension/plpython3u--unpackaged--1.0.sql /usr/local/share/postgresql/extension/plpython3u--unpackaged--1.0.sqlhttps://stackoverflow.com/questions/49379401
复制相似问题