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.

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 adminpack WITH SCHEMA public;
ERROR:  extension "adminpack" must be installed in schema "pg_catalog"

Create an extension and any dependencies:

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

Categories

DDL, Extension, SQL command

See also

ALTER EXTENSION, DROP EXTENSION, extension, pg_extension