1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.38 2004/03/23 02:47:35 neilc Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.39 2004/06/18 06:13:05 tgl Exp $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -22,9 +22,9 @@ PostgreSQL documentation
22
22
<synopsis>
23
23
CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
24
24
[ [ WITH ] [ OWNER [=] <replaceable class="parameter">dbowner</replaceable> ]
25
- [ LOCATION [=] '<replaceable class="parameter">dbpath</replaceable>' ]
26
25
[ TEMPLATE [=] <replaceable class="parameter">template</replaceable> ]
27
- [ ENCODING [=] <replaceable class="parameter">encoding</replaceable> ] ]
26
+ [ ENCODING [=] <replaceable class="parameter">encoding</replaceable> ]
27
+ [ TABLESPACE [=] <replaceable class="parameter">tablespace</replaceable> ] ]
28
28
</synopsis>
29
29
</refsynopsisdiv>
30
30
@@ -50,29 +50,6 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
50
50
privilege can only create databases owned by themselves.
51
51
</para>
52
52
53
- <para>
54
- An alternative location can be specified in order to,
55
- for example, store the database on a different disk.
56
- The path must have been prepared with the
57
- <xref linkend="APP-INITLOCATION" endterm="APP-INITLOCATION-title">
58
- command.
59
- </para>
60
-
61
- <para>
62
- If the path name does not contain a slash, it is interpreted
63
- as an environment variable name, which must be known to the
64
- server process. This way the database administrator can
65
- exercise control over locations in which databases can be created.
66
- (A customary choice is, e.g., <envar>PGDATA2</envar>.)
67
- If the server is compiled with <literal>ALLOW_ABSOLUTE_DBPATHS</literal>
68
- (not so by default), absolute path names, as identified by
69
- a leading slash
70
- (e.g., <filename>/usr/local/pgsql/data</filename>),
71
- are allowed as well.
72
- In either case, the final path name must be absolute and must not
73
- contain any single quotes.
74
- </para>
75
-
76
53
<para>
77
54
By default, the new database will be created by cloning the standard
78
55
system database <literal>template1</>. A different template can be
@@ -83,13 +60,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
83
60
version of <productname>PostgreSQL</productname>. This is useful
84
61
if you wish to avoid copying
85
62
any installation-local objects that may have been added to
86
- <literal>template1</>.
87
- </para>
88
-
89
- <para>
90
- The optional encoding parameter allows selection of the database
91
- encoding. When not specified, it defaults to the encoding used by
92
- the selected template database.
63
+ <literal>template1</>.
93
64
</para>
94
65
</refsect1>
95
66
@@ -101,7 +72,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
101
72
<term><replaceable class="parameter">name</replaceable></term>
102
73
<listitem>
103
74
<para>
104
- The name of a database to create.
75
+ The name of a database to create.
105
76
</para>
106
77
</listitem>
107
78
</varlistentry>
@@ -110,41 +81,43 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
110
81
<listitem>
111
82
<para>
112
83
The name of the database user who will own the new database,
113
- or <literal>DEFAULT</literal> to use the default (namely, the
114
- user executing the command).
84
+ or <literal>DEFAULT</literal> to use the default (namely, the
85
+ user executing the command).
115
86
</para>
116
87
</listitem>
117
88
</varlistentry>
118
89
<varlistentry>
119
- <term><replaceable class="parameter">dbpath </replaceable></term>
90
+ <term><replaceable class="parameter">template </replaceable></term>
120
91
<listitem>
121
92
<para>
122
- An alternate file-system location in which to store the new database,
123
- specified as a string literal;
124
- or <literal>DEFAULT </literal> to use the default location .
93
+ The name of the template from which to create the new database,
94
+ or < literal>DEFAULT</literal> to use the default template
95
+ ( <literal>template1 </literal>) .
125
96
</para>
126
97
</listitem>
127
98
</varlistentry>
128
99
<varlistentry>
129
- <term><replaceable class="parameter">template </replaceable></term>
100
+ <term><replaceable class="parameter">encoding </replaceable></term>
130
101
<listitem>
131
102
<para>
132
- The name of the template from which to create the new database,
133
- or <literal>DEFAULT</literal> to use the default template
134
- (<literal>template1</literal>).
103
+ Character set encoding to use in the new database. Specify
104
+ a string constant (e.g., <literal>'SQL_ASCII'</literal>),
105
+ or an integer encoding number, or <literal>DEFAULT</literal>
106
+ to use the default encoding. The character sets supported by the
107
+ <productname>PostgreSQL</productname> server are described in
108
+ <xref linkend="multibyte-charset-supported">.
135
109
</para>
136
110
</listitem>
137
111
</varlistentry>
138
112
<varlistentry>
139
- <term><replaceable class="parameter">encoding </replaceable></term>
113
+ <term><replaceable class="parameter">tablespace </replaceable></term>
140
114
<listitem>
141
115
<para>
142
- Character set encoding to use in the new database. Specify
143
- a string constant (e.g., <literal>'SQL_ASCII'</literal>),
144
- or an integer encoding number, or <literal>DEFAULT</literal>
145
- to use the default encoding. The character sets supported by the
146
- <productname>PostgreSQL</productname> server are described in
147
- <xref linkend="multibyte-charset-supported">.
116
+ Specifies the default tablespace for the new database.
117
+ If not specified, the same tablespace that is default for
118
+ the template database is used. See
119
+ <xref linkend="sql-createtablespace" endterm="sql-createtablespace-title">
120
+ for more information.
148
121
</para>
149
122
</listitem>
150
123
</varlistentry>
@@ -167,9 +140,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
167
140
<para>
168
141
Errors along the line of <quote>could not initialize database directory</>
169
142
are most likely related to insufficient permissions on the data
170
- directory, a full disk, or other file system problems. When using an
171
- alternate location, the user under
172
- which the database server is running must have access to the location.
143
+ directory, a full disk, or other file system problems.
173
144
</para>
174
145
175
146
<para>
@@ -181,13 +152,6 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
181
152
wrapper program around this command, provided for convenience.
182
153
</para>
183
154
184
- <para>
185
- There are security issues involved with using alternate database
186
- locations specified with absolute path names; this is why the feature
187
- is not enabled by default. See <xref
188
- linkend="manage-ag-alternate-locs"> for more information.
189
- </para>
190
-
191
155
<para>
192
156
Although it is possible to copy a database other than <literal>template1</>
193
157
by specifying its name as the template, this is not (yet) intended as
@@ -205,24 +169,6 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
205
169
206
170
<programlisting>
207
171
CREATE DATABASE lusiadas;
208
- </programlisting>
209
- </para>
210
-
211
- <para>
212
- To create a new database in an alternate area
213
- <filename>~/private_db</filename>, execute the following from the
214
- shell:
215
-
216
- <programlisting>
217
- mkdir private_db
218
- initlocation ~/private_db
219
- </programlisting>
220
-
221
- Then execute the following from within a
222
- <application>psql</application> session:
223
-
224
- <programlisting>
225
- CREATE DATABASE elsewhere WITH LOCATION '/home/olly/private_db';
226
172
</programlisting>
227
173
</para>
228
174
</refsect1>
0 commit comments