Extension
A package of code and SQL objects to extend PostgreSQL functionality
An extension is a package of code and SQL objects to extend PostgreSQL functionality.
Extension support was introduced in PostgreSQL 9.1.
psql
Available extensions can be listed with the slash command \dx
; \dx+ lists each extension and its associated objects. See below for examples.
System catalogue objects
Tables
Views
Functions
pg_extension_update_paths()
Contrib modules
Most contrib modules are implemented as extensions.
Suitable existing contrib modules were converted en-mass to extensions in commit 629b3af2.
Change history
- PostgreSQL 13
- concept of "trusted extensions" added (commit 50fc694e)
- PostgreSQL 9.1
- many contrib modules converted to extensions (commit 629b3af2)
- added (commit d9572c4e)
Examples
postgres=# \dx List of installed extensions Name | Version | Schema | Description --------------------+---------+------------+----------------------------------------------------------- pg_stat_statements | 1.7 | public | track execution statistics of all SQL statements executed plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language (2 rows) postgres=# \dx+ Objects in extension "pg_stat_statements" Object description --------------------------------------------------- function pg_stat_statements(boolean) function pg_stat_statements_reset(oid,oid,bigint) view pg_stat_statements (3 rows) Objects in extension "plpgsql" Object description ------------------------------------------- function plpgsql_call_handler() function plpgsql_inline_handler(internal) function plpgsql_validator(oid) language plpgsql (4 rows)
References
- PostgreSQL documentation: Packaging Related Objects into an Extension
- PostgreSQL documentation: Extension Building Infrastructure
- PostgreSQL documentation: CREATE EXTENSION
- PostgreSQL documentation: ALTER EXTENSION
- PostgreSQL documentation: DROP EXTENSION