Postgresql – List PostgreSQL extensions per database

postgresqlpostgresql-9.5postgresql-extensions

I have a Postgres 9.5 server with 30 databases.

I would like to find out which database uses which extension(s) in one go, preferably in a query that is usable in pgAdmin.

I know that SELECT * FROM pg_extension gives me the extensions for the database I am connected to.

I also know that SELECT * FROM pg_available_extensions lists, well, all available extensions.

I also know that SELECT * FROM pg_database lists all existing databases.

Question

How can I create a list that includes the database name and the extensions used in each database?

Best Answer

You connect to each database in turn and query pg_extension.