Re: [GENERAL] Omitting tablespace creation from pg_dumpall... - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [GENERAL] Omitting tablespace creation from pg_dumpall...
Date
Msg-id 200606162201.k5GM1WD20812@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Should pg_dumpall be using the "SET default_tablespace = foo" method as
> > well?
>
> That would mean changing the semantics of CREATE DATABASE; currently it
> copies the default tablespace from the template database, rather than
> looking at default_tablespace.  I'm unsure if that's a good idea or not.
> None of the other properties of a database are handled that way.

Interesting distinction.

I have added a documentation and code comment patch for this.

--
  Bruce Momjian   http://candle.pha.pa.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/ref/pg_dumpall.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v
retrieving revision 1.55
diff -c -c -r1.55 pg_dumpall.sgml
*** doc/src/sgml/ref/pg_dumpall.sgml    1 Nov 2005 21:09:50 -0000    1.55
--- doc/src/sgml/ref/pg_dumpall.sgml    16 Jun 2006 21:56:58 -0000
***************
*** 377,382 ****
--- 377,389 ----
     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: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.79
diff -c -c -r1.79 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c    7 Jun 2006 22:24:45 -0000    1.79
--- src/bin/pg_dump/pg_dumpall.c    16 Jun 2006 21:57:09 -0000
***************
*** 888,894 ****
              appendPQExpBuffer(buf, " ENCODING = ");
              appendStringLiteralConn(buf, dbencoding, conn);

!             /* Output tablespace if it isn't default */
              if (strcmp(dbtablespace, "pg_default") != 0)
                  appendPQExpBuffer(buf, " TABLESPACE = %s",
                                    fmtId(dbtablespace));
--- 888,902 ----
              appendPQExpBuffer(buf, " ENCODING = ");
              appendStringLiteralConn(buf, dbencoding, conn);

!             /*
!              *    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));

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [BUGS] [Win32] Problem with rename()
Next
From: Bruce Momjian
Date:
Subject: Re: plpython improvements