Reputation: 1
Firstly, if you're not using 9.1+, please refer to this question.
How do I install an extension to PostgreSQL 9.1?
Upvotes: 90
Views: 126000
Reputation: 181
The extensions available for each version of Postgresql vary. An easy way to check which extensions are available is, as has been already mentioned:
SELECT * FROM pg_available_extensions;
If the extension that you are looking for is available, you can install it using:
CREATE EXTENSION 'extensionName';
or if you want to drop it use:
DROP EXTENSION 'extensionName';
With psql
you can additionally check if the extension has been successfully installed using \dx
, and find more details about the extension using \dx+ extensioName
. It returns additional information about the extension, like which packages are used with it.
If the extension is not available in your Postgres version, then you need to download the necessary binary files and libraries and locate it them at /usr/share/conrib
Upvotes: 5
Reputation: 3201
For the postgrersql10
I have solved it with
yum install postgresql10-contrib
Don't forget to activate extensions in postgresql.conf
shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.track = all
then of course restart
systemctl restart postgresql-10.service
all of the needed extensions you can find here
/usr/pgsql-10/share/extension/
Upvotes: 10
Reputation: 1400
How to download and install if you have SUSE. As an example I am downloading the tablefunc module so I can use crosstab. I have PostgreSQL 9.6.1.
right-click desktop, terminal, type:
sudo zypper in postgreql-contrib
Enter credentials, continue by typing:
y
Run query (I ran mine from pgAdminIII):
CREATE EXTENSION tablefunc;
You should now have the crosstab
function.
I did not have to restart.
Upvotes: 0
Reputation: 1
Postgrseql 9.1 provides for a new command CREATE EXTENSION
. You should use it to install modules.
Modules provided in 9.1 can be found here.. The include,
adminpack , auth_delay , auto_explain , btree_gin , btree_gist
, chkpass , citext , cube , dblink , dict_int
, dict_xsyn , dummy_seclabel , earthdistance , file_fdw , fuzzystrmatch
, hstore , intagg , intarray , isn , lo
, ltree , oid2name , pageinspect , passwordcheck , pg_archivecleanup
, pgbench , pg_buffercache , pgcrypto , pg_freespacemap , pgrowlocks
, pg_standby , pg_stat_statements , pgstattuple , pg_test_fsync , pg_trgm
, pg_upgrade , seg , sepgsql , spi , sslinfo , tablefunc
, test_parser , tsearch2 , unaccent , uuid-ossp , vacuumlo
, xml2
If for instance you wanted to install earthdistance
, simply use this command:
CREATE EXTENSION earthdistance;
If you wanted to install an extension with a hyphen in its name, like uuid-ossp
, you need to enclose the extension name in double quotes:
CREATE EXTENSION "uuid-ossp";
DROP EXTENSION
. You can also get an extension list, and there is basic support for version numbers.Upvotes: 115
Reputation: 821
While Evan Carrol's answer is correct, please note that you need to install the postgresql contrib package in order for the CREATE EXTENSION command to work.
In Ubuntu 12.04 it would go like this:
sudo apt-get install postgresql-contrib
Restart the postgresql server:
sudo /etc/init.d/postgresql restart
All available extension are in:
/usr/share/postgresql/9.1/extension/
Now you can run the CREATE EXTENSION command.
Upvotes: 63
Reputation: 1307
Into psql terminal put:
\i <path to contrib files>
in ubuntu it usually is /usr/share/postgreslq/<your pg version>/contrib/<contrib file>.sql
Upvotes: 0
Reputation: 19471
In addition to the extensions which are maintained and provided by the core PostgreSQL development team, there are extensions available from third parties. Notably, there is a site dedicated to that purpose: http://www.pgxn.org/
Upvotes: 13