¿Cómo puedo importar módulos o instalar extensiones en PostgreSQL 9.1+?


En primer lugar, si no está utilizando 9.1+, por favor consulte esta pregunta.

¿Cómo instalo una extensión a PostgreSQL 9.1?

Author: Community, 2012-01-27

6 answers

Postgrseql 9.1 proporciona un nuevo comando CREATE EXTENSION. Debe usarlo para instalar módulos.

Los módulos proporcionados en 9.1 se pueden encontrar aquí.. 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

Si por ejemplo desea instalar earthdistance, simplemente use este comando:

CREATE EXTENSION earthdistance;

Si desea instalar una extensión con un guion en su nombre, como uuid-ossp, debe incluir el nombre de la extensión entre comillas dobles:

CREATE EXTENSION "uuid-ossp";
 88
Author: Evan Carroll,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-11 18:54:24

Si bien la respuesta de Evan Carrol es correcta, tenga en cuenta que necesita instalar el paquete contrib de postgresql para que el comando CREATE EXTENSION funcione.

En Ubuntu 12.04 sería así:

sudo apt-get install postgresql-contrib

Reinicie el servidor postgresql:

sudo /etc/init.d/postgresql restart

Todas las extensiones disponibles están en:

/usr/share/postgresql/9.1/extension/

Ahora puede ejecutar el comando CREATE EXTENSION.

 50
Author: tani-rokk,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-04-03 09:47:20

Además de las extensiones que son mantenidas y proporcionadas por el equipo de desarrollo de core PostgreSQL, hay extensiones disponibles de terceros. En particular, hay un sitio dedicado a ese propósito: http://www.pgxn.org /

 11
Author: kgrittn,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-04-04 22:21:46

Para el postgrersql10 lo he resuelto con

yum install postgresql10-contrib

No olvide activar las extensiones en postgresql.conf

shared_preload_libraries = 'pg_stat_statements'
pg_stat_statements.track = all

Luego, por supuesto, reinicie

systemctl restart postgresql-10.service 

Todas las extensiones necesarias se pueden encontrar aquí

/usr/pgsql-10/share/extension/
 1
Author: matson kepson,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-18 11:59:35

En el terminal psql poner:

\i <path to contrib files>

En ubuntu suele ser /usr/share/postgreslq/<your pg version>/contrib/<contrib file>.sql

 0
Author: André Herculano,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-06-24 21:22:33

Cómo descargar e instalar si tiene SUSE. Como ejemplo, estoy descargando el módulo tablefunc para poder usar crosstab. Tengo PostgreSQL 9.6.1.

Haga clic con el botón derecho en escritorio, terminal, escriba:

sudo zypper in postgreql-contrib

Ingrese las credenciales, continúe escribiendo:

y

Ejecutar consulta (corrí la mía desde pgAdminIII):

CREATE EXTENSION tablefunc;

Ahora deberías tener la función crosstab.

No tuve que reiniciar.

 0
Author: mountainclimber,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-03 20:31:29