Document issues with non-default tablespaces and pg_dumpall restores.
authorBruce Momjian <bruce@momjian.us>
Fri, 16 Jun 2006 22:01:22 +0000 (22:01 +0000)
committerBruce Momjian <bruce@momjian.us>
Fri, 16 Jun 2006 22:01:22 +0000 (22:01 +0000)
Backpatch documentation addition to 8.1.X.

doc/src/sgml/ref/pg_dumpall.sgml
src/bin/pg_dump/pg_dumpall.c

index 4fa417d3fb13100acb7b732c07dac7b08a9673f5..0ab986466cc55a682f076885c1b71b0c20d7e1cf 100644 (file)
@@ -377,6 +377,13 @@ PostgreSQL documentation
    databases.
   </para>
 
+  <para>
+   <application>pg_dumpall</application> requires all needed
+   tablespace directories to exist before the restore or
+   database creation will fail for databases in non-default
+   locations.
+  </para>
+
  </refsect1>
 
 
index 701b05bc4755f1c057652363688417722c23ad35..20a88443d802811e3a4edd3614ad3732f8366310 100644 (file)
@@ -888,7 +888,15 @@ dumpCreateDB(PGconn *conn)
                        appendPQExpBuffer(buf, " ENCODING = ");
                        appendStringLiteralConn(buf, dbencoding, conn);
 
-                       /* Output tablespace if it isn't default */
+                       /*
+                        *      Output tablespace if it isn't the default.  For default, it
+                        *      uses the default from the template database.  If tablespace
+                        *      is specified and tablespace creation failed earlier,
+                        *      (e.g. no such directory), the database creation will fail
+                        *      too.  One solution would be to use 'SET default_tablespace'
+                        *      like we do in pg_dump for setting non-default database
+                        *      locations.
+                        */
                        if (strcmp(dbtablespace, "pg_default") != 0)
                                appendPQExpBuffer(buf, " TABLESPACE = %s",
                                                                  fmtId(dbtablespace));