To reduce confusion over whether VACUUM FULL is needed for anti-wraparound
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Dec 2008 18:16:18 +0000 (18:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Dec 2008 18:16:18 +0000 (18:16 +0000)
vacuuming (it's not), say "database-wide VACUUM" instead of "full-database
VACUUM" in the relevant hint messages.  Also, document the permissions needed
to do this.  Per today's discussion.

doc/src/sgml/maintenance.sgml
doc/src/sgml/ref/vacuum.sgml
src/backend/access/transam/varsup.c

index 4ae6bd55537f8dac81904607cf085ebd1a069f68..03ce2e94ab0c83d8a3ee6ca6250dcb9029bc048c 100644 (file)
@@ -472,9 +472,13 @@ SELECT datname, age(datfrozenxid) FROM pg_database;
 
 <programlisting>
 WARNING:  database "mydb" must be vacuumed within 177009986 transactions
-HINT:  To avoid a database shutdown, execute a full-database VACUUM in "mydb".
+HINT:  To avoid a database shutdown, execute a database-wide VACUUM in "mydb".
 </programlisting>
 
+    (A manual <command>VACUUM</> should fix the problem, as suggested by the
+    hint; but note that the <command>VACUUM</> must be performed by a
+    superuser, else it will fail to process system catalogs and thus not
+    be able to advance the database's <structfield>datfrozenxid</>.)
     If these warnings are
     ignored, the system will shut down and refuse to execute any new
     transactions once there are fewer than 1 million transactions left
index 6364ff030c76393a0878100ab4b92d3afa8366bb..bee0667982d1c9d0c196603e2ff754d9c287670f 100644 (file)
@@ -40,8 +40,8 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
 
   <para>
    With no parameter, <command>VACUUM</command> processes every table in the
-   current database.  With a parameter, <command>VACUUM</command> processes
-   only that table.
+   current database that the current user has permission to vacuum.
+   With a parameter, <command>VACUUM</command> processes only that table.
   </para>
 
   <para>
@@ -146,6 +146,16 @@ VACUUM [ FULL ] [ FREEZE ] [ VERBOSE ] ANALYZE [ <replaceable class="PARAMETER">
  <refsect1>
   <title>Notes</title>
 
+   <para>
+    To vacuum a table, one must ordinarily be the table's owner or a
+    superuser.  However, database owners are allowed to
+    vacuum all tables in their databases, except shared catalogs.
+    (The restriction for shared catalogs means that a true database-wide
+    <command>VACUUM</> can only be performed by a superuser.)
+    <command>VACUUM</> will skip over any tables that the calling user
+    does not have permission to vacuum.
+   </para>
+
    <para>
     <command>VACUUM</> cannot be executed inside a transaction block.
    </para>
index 3faf12272d05b1cc368697fc165f9eb18083baea..8cadc3c0d474ce2af3261ef6eee9a5c070d42322 100644 (file)
@@ -93,7 +93,7 @@ GetNewTransactionId(bool isSubXact)
                        (errmsg("database \"%s\" must be vacuumed within %u transactions",
                                        NameStr(ShmemVariableCache->limit_datname),
                                        ShmemVariableCache->xidWrapLimit - xid),
-                        errhint("To avoid a database shutdown, execute a full-database VACUUM in \"%s\".",
+                        errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".",
                                         NameStr(ShmemVariableCache->limit_datname))));
        }
 
@@ -299,7 +299,7 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid,
                   (errmsg("database \"%s\" must be vacuumed within %u transactions",
                                   NameStr(*oldest_datname),
                                   xidWrapLimit - curXid),
-                       errhint("To avoid a database shutdown, execute a full-database VACUUM in \"%s\".",
+                       errhint("To avoid a database shutdown, execute a database-wide VACUUM in \"%s\".",
                                        NameStr(*oldest_datname))));
 }