- </para>
- </refsect2>
- </refsynopsisdiv>
-
- <refsect1 id="R1-SQL-CREATEDATABASE-1">
- <refsect1info>
- <date>1999-12-11</date>
- </refsect1info>
- <title>
- Description
- </title>
- <para>
- <command>CREATE DATABASE</command> creates a new
- <productname>Postgres</productname> database.
- The creator becomes the owner of the new database.
- </para>
-
- <para>
- An alternate location can be specified in order to,
- for example, store the database on a different disk.
- The path must have been prepared with the
- <xref linkend="APP-INITLOCATION" endterm="APP-INITLOCATION-title">
- command.
- </para>
- <para>
- If the path name does not contain a slash, it is interpreted
- as an environment variable name, which must be known to the
- server process. This way the database administrator can
- exercise control over locations in which databases can be created.
- (A customary choice is, e.g., '<envar>PGDATA2</envar>'.)
- If the server is compiled with <literal>ALLOW_ABSOLUTE_DBPATHS</literal>
- (not so by default), absolute path names, as identified by
- a leading slash
- (e.g., '<filename>/usr/local/pgsql/data</filename>'),
- are allowed as well.
- </para>
-
- <para>
- By default, the new database will be created by cloning the standard
- system database <literal>template1</>. A different template can be
- specified by writing <literal>TEMPLATE =</>
- <replaceable class="parameter">name</replaceable>. In particular,
- by writing <literal>TEMPLATE = template0</>, you can create a virgin
- database containing only the standard objects predefined by your
- version of Postgres. This is useful if you wish to avoid copying
- any installation-local objects that may have been added to template1.
- </para>
-
- <para>
- The optional encoding parameter allows selection of the database encoding,
- if your server was compiled with multibyte encoding support. When not
- specified, it defaults to the encoding used by the selected template
- database.
- </para>