328

如何从 psql 列出已安装在数据库或模式中的所有扩展?

也可以看看

4

3 回答 3

518

In psql that would be

\dx

See the manual of psql for details.

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

SELECT * 
FROM pg_extension;
于 2014-02-15T16:04:38.080 回答
116

此外,如果您想知道您的服务器上有哪些扩展可用:SELECT * FROM pg_available_extensions.

pg_available_extensionspg_available_extension_versions

于 2017-07-06T07:56:33.727 回答
14

此 SQL 查询给出的输出类似于\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;

感谢https://blog.dbi-services.com/listing-the-extensions-available-in-postgresql/

于 2019-07-08T05:53:33.163 回答