<primary>control file</primary>
</indexterm>
<para>
The <command>CREATE EXTENSION</command> command relies on a control
file for each extension, which must be named the same as the extension
with a suffix of <literal>.control</literal>, and must be placed in the
installation's <literal>SHAREDIR/extension</literal> directory. There
must also be at least one <acronym>SQL</acronym> script file, which follows the
naming pattern
<literal><replaceable>extension</replaceable>--<replaceable>version</replaceable>.sql</literal>
(for example, <literal>foo--1.0.sql</literal> for version <literal>1.0</literal> of
extension <literal>foo</literal>). By default, the script file(s) are also
placed in the <literal>SHAREDIR/extension</literal> directory; but the
control file can specify a different directory for the script file(s).
</para>
<para>
Additional locations for extension control files can be configured using
the parameter <xref linkend="guc-extension-control-path"/>.
</para>
<para>
The file format for an extension control file is the same as for the
<filename>postgresql.conf</filename> file, namely a list of
<replaceable>parameter_name</replaceable> <literal>=</literal> <replaceable>value</replaceable>
assignments, one per line. Blank lines and comments introduced by
<literal>#</literal> are allowed. Be sure to quote any value that is not
a single word or number.
</para>
<para>
A control file can set the following parameters:
</para>
<variablelist>
<varlistentry id="extend-extensions-files-directory">
<term><varname>directory</varname> (<type>string</type>)</term>
<listitem>
<para>
The directory containing the extension's <acronym>SQL</acronym> script
file(s). Unless an absolute path is given, the name is relative to
the directory where the control file was found. By default,
the script files are looked for in the same directory where the
control file was found.
</para>
</listitem>
</varlistentry>
<varlistentry id="extend-extensions-files-default-version">
<term><varname>default_version</varname> (<type>string</type>)</term>
<listitem>
<para>
The default version of the extension (the one that will be installed
if no version is specified in <command>CREATE EXTENSION</command>). Although
this can be omitted, that will result in <command>CREATE EXTENSION</command>
failing if no <literal>VERSION</literal> option appears, so you generally
don't want to do that.
</para>
</listitem>
</varlistentry>
<varlistentry id="extend-extensions-files-comment">
<term><varname>comment</varname> (<type>string</type>)</term>
<listitem>
<para>
A comment (any string) about the extension. The comment is applied
when initially creating an extension, but not during extension updates
(since that might override user-added comments). Alternatively,
the extension's comment can be set by writing
a <xref linkend="sql-comment"/> command in the script file.
</para>
</listitem>
</varlistentry>
<varlistentry id="extend-extensions-files-encoding">
<term><varname>encoding</varname> (<type>string</type>)</term>
<listitem>
<para>
The character set encoding used by the script file(s). This should
be specified if the script files contain any non-ASCII characters.
Otherwise the files will be assumed to be in the database encoding.
</para>
</listitem>
</varlistentry>
<varlistentry id="extend-extensions-files-module-pathname">
<term><varname>module_pathname</varname> (<type>string</type>)</term>
<listitem>
<para>
The value of this parameter will be substituted for each occurrence