PostgreSQL 10.6 x64安装上的plpython3u扩展不起作用

时间:2018-11-21 14:41:55

标签: python python-3.x postgresql plpython postgres-plpython

我已经在Ubuntu 18.04LTS上安装了postgresql-plpython3-10.6。

$apt-cache show postgresql-plpython3-10 
Package: postgresql-plpython3-10
Architecture: amd64
Version: 10.6-0ubuntu0.18.04.1
Priority: optional
Section: database
Source: postgresql-10
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PostgreSQL Maintainers <pkg-postgresql-public@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 175
Provides: postgresql-plpython3
Depends: postgresql-10 (= 10.6-0ubuntu0.18.04.1), libc6 (>= 2.14), libpython3.6 (>= 3.6.4~rc1)
Filename: pool/main/p/postgresql-10/postgresql-plpython3-10_10.6-0ubuntu0.18.04.1_amd64.deb
Size: 50604
MD5sum: ae221fed8eecaaacbcddf83493a5d9fb
SHA1: feab57eb4c89a794584d645a473aba8815ccee39
SHA256: 5008f1c02ee52259f8ebc3ea86d284ecad143c559036fbe1117ba892fd008b1b
Homepage: http://www.postgresql.org/
Description-en: PL/Python 3 procedural language for PostgreSQL 10
 PL/Python 3 enables an SQL developer to write procedural language functions
 for PostgreSQL 10 in Python 3.  You need this package if you have any
 PostgreSQL 10 functions that use the languages plpython3 or plpython3u.
 .
 PostgreSQL is an object-relational SQL database management system.
Description-md5: af8c237d81329f682791eed96314243b
Supported: 5y

Package: postgresql-plpython3-10
Architecture: amd64
Version: 10.3-1
Priority: optional
Section: database
Source: postgresql-10
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian PostgreSQL Maintainers <pkg-postgresql-public@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 174
Provides: postgresql-plpython3
Depends: postgresql-10 (= 10.3-1), libc6 (>= 2.14), libpython3.6 (>= 3.6.4~rc1)
Filename: pool/main/p/postgresql-10/postgresql-plpython3-10_10.3-1_amd64.deb
Size: 49668
MD5sum: 4ad3e726ebca1e7415781d158d25a49f
SHA1: 64cc2370ab1b55b24f23acd9e6cb3af4167fd742
SHA256: 6d515ca4106ca322d4706d49039c312a1dbee1626d53cc5d98ced560e2e1ff70
Homepage: http://www.postgresql.org/
Description-en: PL/Python 3 procedural language for PostgreSQL 10
 PL/Python 3 enables an SQL developer to write procedural language functions
 for PostgreSQL 10 in Python 3.  You need this package if you have any
 PostgreSQL 10 functions that use the languages plpython3 or plpython3u.
 .
 PostgreSQL is an object-relational SQL database management system.
Description-md5: af8c237d81329f682791eed96314243b
Supported: 5y

但是当我尝试在数据库中启用plpython3u时,出现错误:

    $sudo psql -h localhost -p 5432 -U root -W
psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1))
Type "help" for help.
root=# CREATE EXTENSION plpython3u;
ERROR:  could not open extension control file "/usr/share/postgresql/10/extensio/plpython3u.control": 
No such file or directory
root=# \q`
  

错误:无法打开扩展控制文件“ /usr/share/postgresql/10/extension/plpython3u.control”:没有这样的文件或目录

但仍然存在,

    /usr/share/postgresql/10/extension$ stat plpython3u.control 
  File: plpython3u.control
  Size: 196             Blocks: 8          IO Block: 4096   regular file
Device: 805h/2053d      Inode: 3033773     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2018-11-21 12:09:16.000000000 +0300
Modify: 2018-11-13 23:18:23.000000000 +0300
Change: 2018-11-21 12:09:17.160954213 +0300
 Birth: -
/usr/share/postgresql/10/extension$ ls -lha pl*
-rw-r--r-- 1 root root 332 ноя 13 23:18 plpgsql--1.0.sql
-rw-r--r-- 1 root root 179 ноя 13 23:18 plpgsql.control
-rw-r--r-- 1 root root 381 ноя 13 23:18 plpgsql--unpackaged--1.0.sql
-rw-r--r-- 1 root root 351 ноя 13 23:18 plpython2u--1.0.sql
-rw-r--r-- 1 root root 196 ноя 13 23:18 plpython2u.control
-rw-r--r-- 1 root root 402 ноя 13 23:18 plpython2u--unpackaged--1.0.sql
-rw-r--r-- 1 root root 351 ноя 13 23:18 plpython3u--1.0.sql
-rw-r--r-- 1 root root 196 ноя 13 23:18 plpython3u.control
-rw-r--r-- 1 root root 402 ноя 13 23:18 plpython3u--unpackaged--1.0.sql
-rw-r--r-- 1 root root 347 ноя 13 23:18 plpythonu--1.0.sql
-rw-r--r-- 1 root root 194 ноя 13 23:18 plpythonu.control
-rw-r--r-- 1 root root 393 ноя 13 23:18 plpythonu--unpackaged--1.0.sql

从sudo运行pgsql也无济于事。 我看到其他类似的问题,例如Install plpython3u for PostgreSQL 9.5 on CentOS 7.2,但没有解决方案。

如何解决该错误?

0 个答案:

没有答案