【问题标题】:Postgres Extesions Not Available - CentOS 8Postgres 扩展不可用 - CentOS 8
【发布时间】:2021-01-19 14:09:04
【问题描述】:

我最近在我的 CentOS 8 机器上安装了 PostgreSQL 12。似乎没有可用的扩展,当我尝试创建一个时,我收到以下错误:

[lloyd@localhost postgres]$ PATH=/home/lloyd/opt/GNAT/2019/bin:$PATH
[lloyd@localhost postgres]$ sudo -u postgres psql
[sudo] password for lloyd: 
could not change directory to "/home/lloyd/gnatcoll-db-20.0/postgres": Permission denied
psql (12.4)
Type "help" for help.

postgres=# \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(1 row)

postgres=# CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
ERROR:  could not open extension control file "/usr/pgsql-12/share/extension/uuid-ossp.control": No such file or directory
postgres=# 

任何关于为什么会发生这种情况的帮助将不胜感激。

谢谢, 劳埃德

【问题讨论】:

  • 你能检查一下你是否安装了像 postgresql12-contrib 或类似的包吗?有时这些被拉到这样的包中。
  • 某些语言(plpgsql、plpythonu、plperl、pltcl)内置于核心软件附带的扩展中。其他扩展(例如 uuid-ossp)要么在 @g_bor 指出的 contrib 中,要么来自其他地方。

标签: linux postgresql centos8


【解决方案1】:

对于偶然发现此问题的任何其他人,这是因为您需要先安装 contrib 软件包,然后才能访问 uuid-ossp 软件包。

首先,通过 ssh 进入您的服务器并通过运行以下命令安装 postgresql-contrib

注意:我安装了 postgres12,结果安装了 postgresql12-contrib 而不是 postgresql-contrib,因为 postgresql-contrib 安装了看起来像 postgresql10-contrib 的东西。

sudo dnf install postgresql12-contrib

确保对于您的 postgresql 版本,这是正确的 contrib 版本。您可以通过确保安装的输出包括以下内容来做到这一点:

postgresql<your-version>-contrib-X.X-1PGDG.rhel8.x86_64.rpm

现在,您应该可以添加扩展程序了!

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

【讨论】:

  • 这个解决方案对我有用,但我用yum pkg manager 安装了所需的包而不是sudo yum install postgresql12-contrib
猜你喜欢
  • 2013-12-23
  • 2021-03-16
  • 2020-11-29
  • 2014-11-16
  • 1970-01-01
  • 1970-01-01
  • 2022-12-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多