CREATE EXTENSION

A DDL command to create an extension

CREATE EXTENSION is a DDL command to create an extension.

CREATE EXTENSION was added in PostgreSQL 9.1 (commit d9572c4e).

Change history

Examples

Simplest variant:

postgres=# CREATE EXTENSION pg_stat_statements;
CREATE EXTENSION

Extension creation in a user-specified schema:

postgres=# CREATE EXTENSION pg_stat_statements WITH SCHEMA pgss;
CREATE EXTENSION

Extension creation in a user-specified schema is not possible with some extensions:

postgres=# CREATE EXTENSION repmgr WITH SCHEMA pgss;
ERROR:  extension "repmgr" must be installed in schema "repmgr"

Create an extension and any dependencies:

postgres=# CREATE EXTENSION bool_plperlu CASCADE;
NOTICE:  installing required extension "plperlu"
CREATE EXTENSION

Categories

DDL, Extension

See also

extension, ALTER EXTENSION, DROP EXTENSION, pg_extension