1CREATE EXTENSION(7)     PostgreSQL 9.2.24 Documentation    CREATE EXTENSION(7)
2
3
4

NAME

6       CREATE_EXTENSION - install an extension
7

SYNOPSIS

9       CREATE EXTENSION [ IF NOT EXISTS ] extension_name
10           [ WITH ] [ SCHEMA schema_name ]
11                    [ VERSION version ]
12                    [ FROM old_version ]
13

DESCRIPTION

15       CREATE EXTENSION loads a new extension into the current database. There
16       must not be an extension of the same name already loaded.
17
18       Loading an extension essentially amounts to running the extension's
19       script file. The script will typically create new SQL objects such as
20       functions, data types, operators and index support methods.  CREATE
21       EXTENSION additionally records the identities of all the created
22       objects, so that they can be dropped again if DROP EXTENSION is issued.
23
24       Loading an extension requires the same privileges that would be
25       required to create its component objects. For most extensions this
26       means superuser or database owner privileges are needed. The user who
27       runs CREATE EXTENSION becomes the owner of the extension for purposes
28       of later privilege checks, as well as the owner of any objects created
29       by the extension's script.
30

PARAMETERS

32       IF NOT EXISTS
33           Do not throw an error if an extension with the same name already
34           exists. A notice is issued in this case. Note that there is no
35           guarantee that the existing extension is anything like the one that
36           would have been created from the currently-available script file.
37
38       extension_name
39           The name of the extension to be installed.  PostgreSQL will create
40           the extension using details from the file
41           SHAREDIR/extension/extension_name.control.
42
43       schema_name
44           The name of the schema in which to install the extension's objects,
45           given that the extension allows its contents to be relocated. The
46           named schema must already exist. If not specified, and the
47           extension's control file does not specify a schema either, the
48           current default object creation schema is used.
49
50           Remember that the extension itself is not considered to be within
51           any schema: extensions have unqualified names that must be unique
52           database-wide. But objects belonging to the extension can be within
53           schemas.
54
55       version
56           The version of the extension to install. This can be written as
57           either an identifier or a string literal. The default version is
58           whatever is specified in the extension's control file.
59
60       old_version
61           FROMold_version must be specified when, and only when, you are
62           attempting to install an extension that replaces an “old style”
63           module that is just a collection of objects not packaged into an
64           extension. This option causes CREATE EXTENSION to run an
65           alternative installation script that absorbs the existing objects
66           into the extension, instead of creating new objects. Be careful
67           that SCHEMA specifies the schema containing these pre-existing
68           objects.
69
70           The value to use for old_version is determined by the extension's
71           author, and might vary if there is more than one version of the
72           old-style module that can be upgraded into an extension. For the
73           standard additional modules supplied with pre-9.1 PostgreSQL, use
74           unpackaged for old_version when updating a module to extension
75           style.
76

NOTES

78       Before you can use CREATE EXTENSION to load an extension into a
79       database, the extension's supporting files must be installed.
80       Information about installing the extensions supplied with PostgreSQL
81       can be found in Additional Supplied Modules.
82
83       The extensions currently available for loading can be identified from
84       the pg_available_extensions or pg_available_extension_versions system
85       views.
86
87       For information about writing new extensions, see Section 35.15,
88       “Packaging Related Objects into an Extension”, in the documentation.
89

EXAMPLES

91       Install the hstore extension into the current database:
92
93           CREATE EXTENSION hstore;
94
95       Update a pre-9.1 installation of hstore into extension style:
96
97           CREATE EXTENSION hstore SCHEMA public FROM unpackaged;
98
99       Be careful to specify the schema in which you installed the existing
100       hstore objects.
101

COMPATIBILITY

103       CREATE EXTENSION is a PostgreSQL extension.
104

SEE ALSO

106       ALTER EXTENSION (ALTER_EXTENSION(7)), DROP EXTENSION
107       (DROP_EXTENSION(7))
108
109
110
111PostgreSQL 9.2.24                 2017-11-06               CREATE EXTENSION(7)
Impressum