CREATE EXTENSION

Synopsis

Use the CREATE EXTENSION statement to load an extension into a database.

Syntax

create_extension ::= CREATE EXTENSION [ IF NOT EXISTS ] extension_name 
                      [ WITH ] [ SCHEMA schema_name ] 
                     [ VERSION version ] [ CASCADE ]

create_extension

CREATEEXTENSIONIFNOTEXISTSextension_nameWITHSCHEMAschema_nameVERSIONversionCASCADE

Semantics

  • SCHEMA, VERSION, and CASCADE may be reordered.

Examples

CREATE SCHEMA myschema;
CREATE EXTENSION pgcrypto WITH SCHEMA myschema VERSION '1.3';
CREATE EXTENSION
CREATE EXTENSION IF NOT EXISTS earthdistance CASCADE;
NOTICE:  installing required extension "cube"
CREATE EXTENSION

See also