Using psql how do I list extensions installed in a database?

主宰稳场 提交于 2019-11-27 09:20:11

问题


How do I list all extensions that are already installed in a database or schema from psql?

See also

  • Finding a list of available extensions that PostgreSQL ships with

回答1:


In psql that would be

\dx

See the manual for details: http://www.postgresql.org/docs/current/static/app-psql.html

Doing it in plain SQL it would be a select on pg_extension:

SELECT * 
FROM pg_extension

http://www.postgresql.org/docs/current/static/catalog-pg-extension.html




回答2:


Additionally if you want to know which extensions are available on your server: SELECT * FROM pg_available_extensions




回答3:


This SQL query gives output similar to \dx:

SELECT e.extname AS "Name", e.extversion AS "Version", n.nspname AS "Schema", c.description AS "Description" 
FROM pg_catalog.pg_extension e 
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace 
LEFT JOIN pg_catalog.pg_description c ON c.objoid = e.oid AND c.classoid = 'pg_catalog.pg_extension'::pg_catalog.regclass 
ORDER BY 1;

Thanks to https://blog.dbi-services.com/listing-the-extensions-available-in-postgresql/



来源:https://stackoverflow.com/questions/21799956/using-psql-how-do-i-list-extensions-installed-in-a-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!