18

I’m using Postgres 9.3 on Ubuntu Linux 14.04. How do I install/enable the uuid-ossp extension? I first verified the contrib package was installed …

root@prodbox:/home/rails/myproject# apt-get install postgresql-contrib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
postgresql-contrib is already the newest version.

and then I logged in and tried to create the extension …

root@prodbox:/home/rails/myproject# su - postgres
postgres@prodbox:~$ psql
psql (9.6.0, server 9.3.11)
Type "help" for help.

postgres=# CREATE EXTENSION "uuid-ossp";
ERROR:  could not open extension control file "/usr/share/postgresql/9.3/extension/uuid-ossp.control": No such file or directory

I’m all out of ideas. What am I missing?

0

2 Answers 2

5

You seem to have two versions (9.6 and 9.3) installed (because the psql version is 9.6). Because the postgresql-contrib package automatically defaults to the currently supported PostgreSQL database contrib package (as noted if you do apt-cache show postgresql-contrib), you'll have to install the contrib package for 9.3:

apt-get install postgresql-contrib-9.3
1
  • also works when creating a Docker image of Postgres 9.3. Just add -y to the command so it installs without asking for confirmation
    – ssimm
    Commented Sep 15, 2021 at 14:59
5

These steps worked for me in my centos 7, when I was facing this issue in my postgres 12,

  1. sudo yum install postgresql-contrib-12

  2. sudo su - postgres or whatever your username for postgres is

  3. psql to enter into postgresql cli commands line

  4. CREATE EXTENSION "uuid-ossp";

3
  • 2
    Use postgresql14-contrib Commented Oct 16, 2022 at 7:00
  • 1
    For the Almalinux 9, we will need postgresql15-contrib Commented May 30 at 8:16
  • Running "Rocky Linux 9.4 (Blue Onyx)": dnf install postgresql16-contrib
    – MMJ
    Commented Sep 20 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.