mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Clean up treatment of creating/dropping databases in User's Guide and
Admin Guide. Move discussion of template databases out of footnotes in CREATE DATABASE ref page and into a section of the Admin Guide. Clean up various obsolete claims, do some copy-editing.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.20 2001/09/13 15:55:24 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_database.sgml,v 1.21 2001/11/18 00:38:00 tgl Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
@@ -202,7 +202,8 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
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.
|
||||
any installation-local objects that may have been added to
|
||||
<literal>template1</>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -259,44 +260,11 @@ comment from Olly; response from Thomas...
|
||||
-->
|
||||
|
||||
<para>
|
||||
Although it is possible to copy a database other than template1 by
|
||||
specifying its name as the template, this is not (yet) intended as
|
||||
a general-purpose COPY DATABASE facility. In particular, it is
|
||||
essential that the source database be idle (no data-altering transactions
|
||||
in progress)
|
||||
for the duration of the copying operation. CREATE DATABASE will check
|
||||
that no backend processes (other than itself) are connected to
|
||||
the source database at the start of the operation, but this does not
|
||||
guarantee that changes cannot be made while the copy proceeds. Therefore,
|
||||
we recommend that databases used as templates be treated as read-only.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Two useful flags exist in <literal>pg_database</literal> for each
|
||||
database: <literal>datistemplate</literal> and
|
||||
<literal>datallowconn</literal>. <literal>datistemplate</literal>
|
||||
may be set to indicate that a database is intended as a template for
|
||||
CREATE DATABASE. If this flag is set, the database may be cloned by
|
||||
any user with CREATEDB privileges; if it is not set, only superusers
|
||||
and the owner of the database may clone it.
|
||||
If <literal>datallowconn</literal> is false, then no new connections
|
||||
to that database will be allowed (but existing sessions are not killed
|
||||
simply by setting the flag false). The <literal>template0</literal>
|
||||
database is normally marked this way to prevent modification of it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After preparing a template database, or making any changes to one,
|
||||
it is a good idea to perform
|
||||
<command>VACUUM FREEZE</> or <command>VACUUM FULL FREEZE</> in that
|
||||
database. If this is done when there are no other open transactions
|
||||
in the same database, then it is guaranteed that all tuples in the
|
||||
database are <quote>frozen</> and will not be subject to transaction
|
||||
ID wraparound problems. This is particularly important for a database
|
||||
that will have <literal>datallowconn</literal> set to false, since it
|
||||
will be impossible to do routine maintenance <command>VACUUM</>s on
|
||||
such a database.
|
||||
See the Administrator's Guide for more information.
|
||||
Although it is possible to copy a database other than <literal>template1</>
|
||||
by specifying its name as the template, this is not (yet) intended as
|
||||
a general-purpose COPY DATABASE facility.
|
||||
We recommend that databases used as templates be treated as read-only.
|
||||
See the <citetitle>Administrator's Guide</> for more information.
|
||||
</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.12 2001/09/03 12:57:49 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_database.sgml,v 1.13 2001/11/18 00:38:00 tgl Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
@@ -68,57 +68,18 @@ DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>ERROR: user '<replaceable class="parameter">username</replaceable>' is not allowed to create/drop databases</computeroutput></term>
|
||||
<term><computeroutput>DROP DATABASE: cannot be executed on the currently open database</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
You must have the special CREATEDB privilege to drop databases.
|
||||
See <xref linkend="SQL-CREATEUSER" endterm="SQL-CREATEUSER-title">.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>ERROR: dropdb: cannot be executed on the template database</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>template1</literal> database cannot be removed. It's not in
|
||||
your interest.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>ERROR: dropdb: cannot be executed on an open database</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
You cannot be connected to the database your are about to remove.
|
||||
Instead, you could connect to <literal>template1</literal> or any other
|
||||
You cannot be connected to the database you are about to remove.
|
||||
Instead, connect to <literal>template1</literal> or any other
|
||||
database and run this command again.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>ERROR: dropdb: database '<replaceable class="parameter">name</replaceable>' does not exist</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This message occurs if the specified database does not exist.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>ERROR: dropdb: database '<replaceable class="parameter">name</replaceable>' is not owned by you</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
You must be the owner of the database. Being the owner usually means that
|
||||
you created it as well.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>ERROR: dropdb: May not be called in a transaction block.</computeroutput></term>
|
||||
<term><computeroutput>DROP DATABASE: may not be called in a transaction block</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
You must finish the transaction in progress before you can call this command.
|
||||
@@ -126,17 +87,6 @@ DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><computeroutput>NOTICE: The database directory 'xxx' could not be removed.</computeroutput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The database was dropped (unless other error messages came up), but the
|
||||
directory where the data is stored could not be removed. You must delete
|
||||
it manually.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect2>
|
||||
@@ -156,6 +106,10 @@ DROP DATABASE <replaceable class="PARAMETER">name</replaceable>
|
||||
it).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<command>DROP DATABASE</command> cannot be undone. Use it with care!
|
||||
</para>
|
||||
|
||||
<refsect2 id="R2-SQL-DROPDATABASE-3">
|
||||
<refsect2info>
|
||||
<date>1999-12-11</date>
|
||||
|
||||
Reference in New Issue
Block a user