CREATE EXTENSION7SQL - Language StatementsCREATE EXTENSIONinstall an extensionCREATE EXTENSION
CREATE EXTENSION extension_name
[ WITH ] [ SCHEMA [=] schema ]
DescriptionCREATE EXTENSION loads a new extension into the current
database. There must not be an extension of the same name already loaded.
Loading an extension essentially amounts to running the extension's script
file. The script will typically create new SQL> objects such as
functions, data types, operators and index support methods.
CREATE EXTENSION additionally records the identities
of all the created objects, so that they can be dropped again if
DROP EXTENSION is issued.
For information about writing new extensions, see
.
Only superusers can execute CREATE EXTENSION.
Parametersextension_name
The name of the extension to be
installed. PostgreSQL will create the
extension using details from the file
SHAREDIR/contrib/extension.control.
schema
The name of the schema in which to install the extension's
objects, given that the extension allows its contents to be
relocated. The named schema must already exist.
If not specified, and the extension's control file does not specify a
schema either, the current default object creation schema is used.
Examples
Install the hstore extension into the
current database:
CREATE EXTENSION hstore;
CompatibilityCREATE EXTENSION is a PostgreSQL>
extension.
See Also