CREATE EXTENSION

This page documents the preview version (v2.23). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.

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