HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How do I install/enable the uuid-ossp extension on Postgres 9.3?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
enableinstallthepostgresextensionhowuuidossp

Problem

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?

Solution

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

Code Snippets

apt-get install postgresql-contrib-9.3

Context

StackExchange Database Administrators Q#153017, answer score: 5

Revisions (0)

No revisions yet.