]> begriffs open source - ai-pg/blob - full-docs/html/sql-createdatabase.html
Include latest toc output
[ai-pg] / full-docs / html / sql-createdatabase.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>CREATE DATABASE</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-createconversion.html" title="CREATE CONVERSION" /><link rel="next" href="sql-createdomain.html" title="CREATE DOMAIN" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">CREATE DATABASE</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-createconversion.html" title="CREATE CONVERSION">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-createdomain.html" title="CREATE DOMAIN">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-CREATEDATABASE"><div class="titlepage"></div><a id="id-1.9.3.61.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">CREATE DATABASE</span></h2><p>CREATE DATABASE — create a new database</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
3 CREATE DATABASE <em class="replaceable"><code>name</code></em>
4     [ WITH ] [ OWNER [=] <em class="replaceable"><code>user_name</code></em> ]
5            [ TEMPLATE [=] <em class="replaceable"><code>template</code></em> ]
6            [ ENCODING [=] <em class="replaceable"><code>encoding</code></em> ]
7            [ STRATEGY [=] <em class="replaceable"><code>strategy</code></em> ]
8            [ LOCALE [=] <em class="replaceable"><code>locale</code></em> ]
9            [ LC_COLLATE [=] <em class="replaceable"><code>lc_collate</code></em> ]
10            [ LC_CTYPE [=] <em class="replaceable"><code>lc_ctype</code></em> ]
11            [ BUILTIN_LOCALE [=] <em class="replaceable"><code>builtin_locale</code></em> ]
12            [ ICU_LOCALE [=] <em class="replaceable"><code>icu_locale</code></em> ]
13            [ ICU_RULES [=] <em class="replaceable"><code>icu_rules</code></em> ]
14            [ LOCALE_PROVIDER [=] <em class="replaceable"><code>locale_provider</code></em> ]
15            [ COLLATION_VERSION = <em class="replaceable"><code>collation_version</code></em> ]
16            [ TABLESPACE [=] <em class="replaceable"><code>tablespace_name</code></em> ]
17            [ ALLOW_CONNECTIONS [=] <em class="replaceable"><code>allowconn</code></em> ]
18            [ CONNECTION LIMIT [=] <em class="replaceable"><code>connlimit</code></em> ]
19            [ IS_TEMPLATE [=] <em class="replaceable"><code>istemplate</code></em> ]
20            [ OID [=] <em class="replaceable"><code>oid</code></em> ]
21 </pre></div><div class="refsect1" id="id-1.9.3.61.5"><h2>Description</h2><p>
22    <code class="command">CREATE DATABASE</code> creates a new
23    <span class="productname">PostgreSQL</span> database.
24   </p><p>
25    To create a database, you must be a superuser or have the special
26    <code class="literal">CREATEDB</code> privilege.
27    See <a class="xref" href="sql-createrole.html" title="CREATE ROLE"><span class="refentrytitle">CREATE ROLE</span></a>.
28   </p><p>
29    By default, the new database will be created by cloning the standard
30    system database <code class="literal">template1</code>.  A different template can be
31    specified by writing <code class="literal">TEMPLATE
32    <em class="replaceable"><code>name</code></em></code>.  In particular,
33    by writing <code class="literal">TEMPLATE template0</code>, you can create a pristine
34    database (one where no user-defined objects exist and where the system
35    objects have not been altered)
36    containing only the standard objects predefined by your
37    version of <span class="productname">PostgreSQL</span>.  This is useful
38    if you wish to avoid copying
39    any installation-local objects that might have been added to
40    <code class="literal">template1</code>.
41   </p></div><div class="refsect1" id="id-1.9.3.61.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt id="CREATE-DATABASE-NAME"><span class="term"><em class="replaceable"><code>name</code></em></span> <a href="#CREATE-DATABASE-NAME" class="id_link">#</a></dt><dd><p>
42         The name of a database to create.
43        </p></dd><dt id="CREATE-DATABASE-USER-NAME"><span class="term"><em class="replaceable"><code>user_name</code></em></span> <a href="#CREATE-DATABASE-USER-NAME" class="id_link">#</a></dt><dd><p>
44         The role name of the user who will own the new database,
45         or <code class="literal">DEFAULT</code> to use the default (namely, the
46         user executing the command).  To create a database owned by another
47         role, you must be able to <code class="literal">SET ROLE</code> to that
48         role.
49        </p></dd><dt id="CREATE-DATABASE-TEMPLATE"><span class="term"><em class="replaceable"><code>template</code></em></span> <a href="#CREATE-DATABASE-TEMPLATE" class="id_link">#</a></dt><dd><p>
50         The name of the template from which to create the new database,
51         or <code class="literal">DEFAULT</code> to use the default template
52         (<code class="literal">template1</code>).
53        </p></dd><dt id="CREATE-DATABASE-ENCODING"><span class="term"><em class="replaceable"><code>encoding</code></em></span> <a href="#CREATE-DATABASE-ENCODING" class="id_link">#</a></dt><dd><p>
54         Character set encoding to use in the new database.  Specify
55         a string constant (e.g., <code class="literal">'SQL_ASCII'</code>),
56         or an integer encoding number, or <code class="literal">DEFAULT</code>
57         to use the default encoding (namely, the encoding of the
58         template database). The character sets supported by the
59         <span class="productname">PostgreSQL</span> server are described in
60         <a class="xref" href="multibyte.html#MULTIBYTE-CHARSET-SUPPORTED" title="23.3.1. Supported Character Sets">Section 23.3.1</a>. See below for
61         additional restrictions.
62        </p></dd><dt id="CREATE-DATABASE-STRATEGY"><span class="term"><em class="replaceable"><code>strategy</code></em></span> <a href="#CREATE-DATABASE-STRATEGY" class="id_link">#</a></dt><dd><p>
63         Strategy to be used in creating the new database.  If
64         the <code class="literal">WAL_LOG</code> strategy is used, the database will be
65         copied block by block and each block will be separately written
66         to the write-ahead log. This is the most efficient strategy in
67         cases where the template database is small, and therefore it is the
68         default. The older <code class="literal">FILE_COPY</code> strategy is also
69         available. This strategy writes a small record to the write-ahead log
70         for each tablespace used by the target database. Each such record
71         represents copying an entire directory to a new location at the
72         filesystem level. While this does reduce the write-ahead
73         log volume substantially, especially if the template database is large,
74         it also forces the system to perform a checkpoint both before and
75         after the creation of the new database. In some situations, this may
76         have a noticeable negative impact on overall system performance. The
77         <code class="literal">FILE_COPY</code> strategy is affected by the <a class="xref" href="runtime-config-resource.html#GUC-FILE-COPY-METHOD">file_copy_method</a> setting.
78        </p></dd><dt id="CREATE-DATABASE-LOCALE"><span class="term"><em class="replaceable"><code>locale</code></em></span> <a href="#CREATE-DATABASE-LOCALE" class="id_link">#</a></dt><dd><p>
79         Sets the default collation order and character classification in the
80         new database.  Collation affects the sort order applied to strings,
81         e.g., in queries with <code class="literal">ORDER BY</code>, as well as the order used in indexes
82         on text columns.  Character classification affects the categorization
83         of characters, e.g., lower, upper, and digit.  Also sets the
84         associated aspects of the operating system environment,
85         <code class="literal">LC_COLLATE</code> and <code class="literal">LC_CTYPE</code>.  The
86         default is the same setting as the template database.  See <a class="xref" href="collation.html#COLLATION-MANAGING-CREATE-LIBC" title="23.2.2.3.1. libc Collations">Section 23.2.2.3.1</a> and <a class="xref" href="collation.html#COLLATION-MANAGING-CREATE-ICU" title="23.2.2.3.2. ICU Collations">Section 23.2.2.3.2</a> for details.
87        </p><p>
88         Can be overridden by setting <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LC-COLLATE"><em class="replaceable"><code>lc_collate</code></em></a>, <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LC-CTYPE"><em class="replaceable"><code>lc_ctype</code></em></a>, <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-BUILTIN-LOCALE"><em class="replaceable"><code>builtin_locale</code></em></a>, or <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-ICU-LOCALE"><em class="replaceable"><code>icu_locale</code></em></a> individually.
89        </p><p>
90         If <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE-PROVIDER"><em class="replaceable"><code>locale_provider</code></em></a> is
91         <code class="literal">builtin</code>, then <em class="replaceable"><code>locale</code></em> or
92         <em class="replaceable"><code>builtin_locale</code></em> must be specified and set to
93         either <code class="literal">C</code>, <code class="literal">C.UTF-8</code>, or
94         <code class="literal">PG_UNICODE_FAST</code>.
95        </p><div class="tip"><h3 class="title">Tip</h3><p>
96          The other locale settings <a class="xref" href="runtime-config-client.html#GUC-LC-MESSAGES">lc_messages</a>, <a class="xref" href="runtime-config-client.html#GUC-LC-MONETARY">lc_monetary</a>, <a class="xref" href="runtime-config-client.html#GUC-LC-NUMERIC">lc_numeric</a>, and
97          <a class="xref" href="runtime-config-client.html#GUC-LC-TIME">lc_time</a> are not fixed per database and are not
98          set by this command.  If you want to make them the default for a
99          specific database, you can use <code class="literal">ALTER DATABASE
100          ... SET</code>.
101         </p></div></dd><dt id="CREATE-DATABASE-LC-COLLATE"><span class="term"><em class="replaceable"><code>lc_collate</code></em></span> <a href="#CREATE-DATABASE-LC-COLLATE" class="id_link">#</a></dt><dd><p>
102         Sets <code class="literal">LC_COLLATE</code> in the database server's operating
103         system environment.  The default is the setting of <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a> if specified, otherwise the same
104         setting as the template database.  See below for additional
105         restrictions.
106        </p><p>
107         If <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE-PROVIDER"><em class="replaceable"><code>locale_provider</code></em></a> is
108         <code class="literal">libc</code>, also sets the default collation order to use
109         in the new database, overriding the setting <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a>.
110        </p></dd><dt id="CREATE-DATABASE-LC-CTYPE"><span class="term"><em class="replaceable"><code>lc_ctype</code></em></span> <a href="#CREATE-DATABASE-LC-CTYPE" class="id_link">#</a></dt><dd><p>
111         Sets <code class="literal">LC_CTYPE</code> in the database server's operating
112         system environment.  The default is the setting of <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a> if specified, otherwise the same
113         setting as the template database.  See below for additional
114         restrictions.
115        </p><p>
116         If <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE-PROVIDER"><em class="replaceable"><code>locale_provider</code></em></a> is
117         <code class="literal">libc</code>, also sets the default character
118         classification to use in the new database, overriding the setting
119         <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a>.
120        </p></dd><dt id="CREATE-DATABASE-BUILTIN-LOCALE"><span class="term"><em class="replaceable"><code>builtin_locale</code></em></span> <a href="#CREATE-DATABASE-BUILTIN-LOCALE" class="id_link">#</a></dt><dd><p>
121         Specifies the builtin provider locale for the database default
122         collation order and character classification, overriding the setting
123         <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a>.  The <a class="link" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE-PROVIDER">locale provider</a> must
124         be <code class="literal">builtin</code>.  The default is the setting of <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a> if specified; otherwise the same
125         setting as the template database.
126        </p><p>
127         The locales available for the <code class="literal">builtin</code> provider are
128         <code class="literal">C</code>, <code class="literal">C.UTF-8</code> and
129         <code class="literal">PG_UNICODE_FAST</code>.
130        </p></dd><dt id="CREATE-DATABASE-ICU-LOCALE"><span class="term"><em class="replaceable"><code>icu_locale</code></em></span> <a href="#CREATE-DATABASE-ICU-LOCALE" class="id_link">#</a></dt><dd><p>
131         Specifies the ICU locale (see <a class="xref" href="collation.html#COLLATION-MANAGING-CREATE-ICU" title="23.2.2.3.2. ICU Collations">Section 23.2.2.3.2</a>) for the database default
132         collation order and character classification, overriding the setting
133         <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a>.  The <a class="link" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE-PROVIDER">locale provider</a> must be ICU.  The default
134         is the setting of <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-LOCALE"><em class="replaceable"><code>locale</code></em></a> if
135         specified; otherwise the same setting as the template database.
136        </p></dd><dt id="CREATE-DATABASE-ICU-RULES"><span class="term"><em class="replaceable"><code>icu_rules</code></em></span> <a href="#CREATE-DATABASE-ICU-RULES" class="id_link">#</a></dt><dd><p>
137         Specifies additional collation rules to customize the behavior of the
138         default collation of this database.  This is supported for ICU only.
139         See <a class="xref" href="collation.html#ICU-TAILORING-RULES" title="23.2.3.4. ICU Tailoring Rules">Section 23.2.3.4</a> for details.
140        </p></dd><dt id="CREATE-DATABASE-LOCALE-PROVIDER"><span class="term"><em class="replaceable"><code>locale_provider</code></em></span> <a href="#CREATE-DATABASE-LOCALE-PROVIDER" class="id_link">#</a></dt><dd><p>
141         Specifies the provider to use for the default collation in this
142         database.  Possible values are <code class="literal">builtin</code>,
143         <code class="literal">icu</code><a id="id-1.9.3.61.6.2.12.2.1.3" class="indexterm"></a>
144         (if the server was built with ICU support) or <code class="literal">libc</code>.
145         By default, the provider is the same as that of the <a class="xref" href="sql-createdatabase.html#CREATE-DATABASE-TEMPLATE"><em class="replaceable"><code>template</code></em></a>. See <a class="xref" href="locale.html#LOCALE-PROVIDERS" title="23.1.4. Locale Providers">Section 23.1.4</a> for details.
146        </p></dd><dt id="CREATE-DATABASE-COLLATION-VERSION"><span class="term"><em class="replaceable"><code>collation_version</code></em></span> <a href="#CREATE-DATABASE-COLLATION-VERSION" class="id_link">#</a></dt><dd><p>
147         Specifies the collation version string to store with the database.
148         Normally, this should be omitted, which will cause the version to be
149         computed from the actual version of the database collation as provided
150         by the operating system.  This option is intended to be used by
151         <code class="command">pg_upgrade</code> for copying the version from an existing
152         installation.
153        </p><p>
154         See also <a class="xref" href="sql-alterdatabase.html" title="ALTER DATABASE"><span class="refentrytitle">ALTER DATABASE</span></a> for how to handle
155         database collation version mismatches.
156        </p></dd><dt id="CREATE-DATABASE-TABLESPACE-NAME"><span class="term"><em class="replaceable"><code>tablespace_name</code></em></span> <a href="#CREATE-DATABASE-TABLESPACE-NAME" class="id_link">#</a></dt><dd><p>
157         The name of the tablespace that will be associated with the
158         new database, or <code class="literal">DEFAULT</code> to use the
159         template database's tablespace. This
160         tablespace will be the default tablespace used for objects
161         created in this database. See
162         <a class="xref" href="sql-createtablespace.html" title="CREATE TABLESPACE"><span class="refentrytitle">CREATE TABLESPACE</span></a>
163         for more information.
164        </p></dd><dt id="CREATE-DATABASE-ALLOWCONN"><span class="term"><em class="replaceable"><code>allowconn</code></em></span> <a href="#CREATE-DATABASE-ALLOWCONN" class="id_link">#</a></dt><dd><p>
165          If false then no one can connect to this database.  The default is
166          true, allowing connections (except as restricted by other mechanisms,
167          such as <code class="literal">GRANT</code>/<code class="literal">REVOKE CONNECT</code>).
168         </p></dd><dt id="CREATE-DATABASE-CONNLIMIT"><span class="term"><em class="replaceable"><code>connlimit</code></em></span> <a href="#CREATE-DATABASE-CONNLIMIT" class="id_link">#</a></dt><dd><p>
169         How many concurrent connections can be made
170         to this database.  -1 (the default) means no limit.
171        </p></dd><dt id="CREATE-DATABASE-ISTEMPLATE"><span class="term"><em class="replaceable"><code>istemplate</code></em></span> <a href="#CREATE-DATABASE-ISTEMPLATE" class="id_link">#</a></dt><dd><p>
172          If true, then this database can be cloned by any user with <code class="literal">CREATEDB</code>
173          privileges; if false (the default), then only superusers or the owner
174          of the database can clone it.
175         </p></dd><dt id="CREATE-DATABASE-OID"><span class="term"><em class="replaceable"><code>oid</code></em></span> <a href="#CREATE-DATABASE-OID" class="id_link">#</a></dt><dd><p>
176          The object identifier to be used for the new database. If this
177          parameter is not specified, <span class="productname">PostgreSQL</span>
178          will choose a suitable OID automatically. This parameter is primarily
179          intended for internal use by <span class="application">pg_upgrade</span>,
180          and only <span class="application">pg_upgrade</span> can specify a value
181          less than 16384.
182         </p></dd></dl></div><p>
183    Optional parameters can be written in any order, not only the order
184    illustrated above.
185   </p></div><div class="refsect1" id="id-1.9.3.61.7"><h2>Notes</h2><p>
186     <code class="command">CREATE DATABASE</code> cannot be executed inside a transaction
187     block.
188    </p><p>
189     Errors along the line of <span class="quote">“<span class="quote">could not initialize database directory</span>”</span>
190     are most likely related to insufficient permissions on the data
191     directory, a full disk, or other file system problems.
192    </p><p>
193     Use <a class="link" href="sql-dropdatabase.html" title="DROP DATABASE"><code class="command">DROP DATABASE</code></a> to remove a database.
194    </p><p>
195     The program <a class="xref" href="app-createdb.html" title="createdb"><span class="refentrytitle"><span class="application">createdb</span></span></a> is a
196     wrapper program around this command, provided for convenience.
197    </p><p>
198     Database-level configuration parameters (set via <a class="link" href="sql-alterdatabase.html" title="ALTER DATABASE"><code class="command">ALTER DATABASE</code></a>) and database-level permissions (set via
199     <a class="link" href="sql-grant.html" title="GRANT"><code class="command">GRANT</code></a>) are not copied from the template database.
200    </p><p>
201    Although it is possible to copy a database other than <code class="literal">template1</code>
202    by specifying its name as the template, this is not (yet) intended as
203    a general-purpose <span class="quote">“<span class="quote"><code class="command">COPY DATABASE</code></span>”</span> facility.
204    The principal limitation is that no other sessions can be connected to
205    the template database while it is being copied.  <code class="command">CREATE
206    DATABASE</code> will fail if any other connection exists when it starts;
207    otherwise, new connections to the template database are locked out
208    until <code class="command">CREATE DATABASE</code> completes.
209    See <a class="xref" href="manage-ag-templatedbs.html" title="22.3. Template Databases">Section 22.3</a> for more information.
210   </p><p>
211    The character set encoding specified for the new database must be
212    compatible with the chosen locale settings (<code class="literal">LC_COLLATE</code> and
213    <code class="literal">LC_CTYPE</code>).  If the locale is <code class="literal">C</code> (or equivalently
214    <code class="literal">POSIX</code>), then all encodings are allowed, but for other
215    locale settings there is only one encoding that will work properly.
216    (On Windows, however, UTF-8 encoding can be used with any locale.)
217    <code class="command">CREATE DATABASE</code> will allow superusers to specify
218    <code class="literal">SQL_ASCII</code> encoding regardless of the locale settings,
219    but this choice is deprecated and may result in misbehavior of
220    character-string functions if data that is not encoding-compatible
221    with the locale is stored in the database.
222   </p><p>
223    The encoding and locale settings must match those of the template database,
224    except when <code class="literal">template0</code> is used as template.  This is because
225    other databases might contain data that does not match the specified
226    encoding, or might contain indexes whose sort ordering is affected by
227    <code class="literal">LC_COLLATE</code> and <code class="literal">LC_CTYPE</code>.  Copying such data would
228    result in a database that is corrupt according to the new settings.
229    <code class="literal">template0</code>, however, is known to not contain any data or
230    indexes that would be affected.
231   </p><p>
232    There is currently no option to use a database locale with nondeterministic
233    comparisons (see <a class="link" href="sql-createcollation.html" title="CREATE COLLATION"><code class="command">CREATE
234    COLLATION</code></a> for an explanation).  If this is needed, then
235    per-column collations would need to be used.
236   </p><p>
237    The <code class="literal">CONNECTION LIMIT</code> option is only enforced approximately;
238    if two new sessions start at about the same time when just one
239    connection <span class="quote">“<span class="quote">slot</span>”</span> remains for the database, it is possible that
240    both will fail.  Also, the limit is not enforced against superusers or
241    background worker processes.
242   </p></div><div class="refsect1" id="id-1.9.3.61.8"><h2>Examples</h2><p>
243    To create a new database:
244
245 </p><pre class="programlisting">
246 CREATE DATABASE lusiadas;
247 </pre><p>
248   </p><p>
249    To create a database <code class="literal">sales</code> owned by user <code class="literal">salesapp</code>
250    with a default tablespace of <code class="literal">salesspace</code>:
251
252 </p><pre class="programlisting">
253 CREATE DATABASE sales OWNER salesapp TABLESPACE salesspace;
254 </pre><p>
255   </p><p>
256    To create a database <code class="literal">music</code> with a different locale:
257 </p><pre class="programlisting">
258 CREATE DATABASE music
259     LOCALE 'sv_SE.utf8'
260     TEMPLATE template0;
261 </pre><p>
262     In this example, the <code class="literal">TEMPLATE template0</code> clause is required if
263     the specified locale is different from the one in <code class="literal">template1</code>.
264     (If it is not, then specifying the locale explicitly is redundant.)
265   </p><p>
266    To create a database <code class="literal">music2</code> with a different locale and a
267    different character set encoding:
268 </p><pre class="programlisting">
269 CREATE DATABASE music2
270     LOCALE 'sv_SE.iso885915'
271     ENCODING LATIN9
272     TEMPLATE template0;
273 </pre><p>
274    The specified locale and encoding settings must match, or an error will be
275    reported.
276   </p><p>
277    Note that locale names are specific to the operating system, so that the
278    above commands might not work in the same way everywhere.
279   </p></div><div class="refsect1" id="id-1.9.3.61.9"><h2>Compatibility</h2><p>
280    There is no <code class="command">CREATE DATABASE</code> statement in the SQL
281    standard.  Databases are equivalent to catalogs, whose creation is
282    implementation-defined.
283   </p></div><div class="refsect1" id="id-1.9.3.61.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-alterdatabase.html" title="ALTER DATABASE"><span class="refentrytitle">ALTER DATABASE</span></a>, <a class="xref" href="sql-dropdatabase.html" title="DROP DATABASE"><span class="refentrytitle">DROP DATABASE</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-createconversion.html" title="CREATE CONVERSION">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-createdomain.html" title="CREATE DOMAIN">Next</a></td></tr><tr><td width="40%" align="left" valign="top">CREATE CONVERSION </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> CREATE DOMAIN</td></tr></table></div></body></html>