I have recently installed PostgreSQL 12 on My CentOS 8 Machine. It seems that there are not Extensions available, and when I try to create one I receive the following error:
[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=#
Any help as to why this is happening would be greatly appreciated.
Thanks, Lloyd
For anyone else who stumbles across this issue, this is happening because you need to install the contrib
package first, before gaining access to the uuid-ossp
package.
First, ssh into your server and install postgresql12-contrib
by running the following: Note: I had postgres12 installed and as a result installed postgresql12-contrib
instead of postgresql-contrib
because postgresql-contrib
installs what looks like postgresql10-contrib
.
sudo dnf install postgresql12-contrib
Be sure that this is the correct version of contrib
for your version of postgresql by making sure that the output of the install you see something like:
postgresql<your-version>-contrib-XX-1PGDG.rhel8.x86_64.rpm
Now, you should be able to add your extension!
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.