Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I import modules or install extensions in PostgreSQL 9.1+?

Firstly, if you're not using 9.1+, please refer to this question.

How do I install an extension to PostgreSQL 9.1?

like image 467
NO WAR WITH RUSSIA Avatar asked Jan 26 '12 21:01

NO WAR WITH RUSSIA


People also ask

Where does Postgres install extensions?

Extension Files The file format must be extension_name. control, which tells the basics about extension to PostgreSQL, and must be placed in the installation's SHAREDIR/extension directory.

How do you check if Postgres extension is installed?

Get a list of all the extensions installed on a database by using the \dx command. For example, the output for \dx when run on the Databases for PostgreSQL default database shows the only installed extension.

How do I add extensions to pgAdmin?

Click the Definition tab to continue. Use the Definition tab to select the Schema and Version: Use the drop-down listbox next to Schema to select the name of the schema in which to install the extension's objects. Use the drop-down listbox next to Version to select the version of the extension to install.


1 Answers

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"; 
  • Read more about contrib, and the modules available in 9.1.
  • Read about the new extension infrastructure, and the SQL commands to manage it here You can now more easily uninstall a module, see DROP EXTENSION. You can also get an extension list, and there is basic support for version numbers.
like image 54
NO WAR WITH RUSSIA Avatar answered Oct 06 '22 07:10

NO WAR WITH RUSSIA