diff -urN postgresql-8.2.4/src/bin/pg_dump/pg_backup.h postgresql-8.2.4-new/src/bin/pg_dump/pg_backup.h --- postgresql-8.2.4/src/bin/pg_dump/pg_backup.h 2006-10-14 19:07:22.000000000 -0400 +++ postgresql-8.2.4-new/src/bin/pg_dump/pg_backup.h 2007-07-15 13:17:21.000000000 -0400 @@ -76,6 +76,7 @@ { int create; /* Issue commands to create the database */ int noOwner; /* Don't try to match original object owner */ + bool noTablespace; /* Don't issue tablespace related commands */ int disable_triggers; /* disable triggers during data-only * restore */ int use_setsessauth;/* Use SET SESSION AUTHORIZATION commands diff -urN postgresql-8.2.4/src/bin/pg_dump/pg_backup_archiver.c postgresql-8.2.4-new/src/bin/pg_dump/pg_backup_archiver.c --- postgresql-8.2.4/src/bin/pg_dump/pg_backup_archiver.c 2007-02-19 10:05:21.000000000 -0500 +++ postgresql-8.2.4-new/src/bin/pg_dump/pg_backup_archiver.c 2007-07-15 13:17:21.000000000 -0400 @@ -2351,7 +2351,7 @@ qry = createPQExpBuffer(); - if (strcmp(want, "") == 0) + if ( (strcmp(want, "") == 0) || ( AH->ropt->noTablespace ) ) { /* We want the tablespace to be the database's default */ appendPQExpBuffer(qry, "SET default_tablespace = ''"); @@ -2529,7 +2529,7 @@ pfx, te->tag, te->desc, te->namespace ? te->namespace : "-", ropt->noOwner ? "-" : te->owner); - if (te->tablespace) + if ( ( te->tablespace) && ( !ropt->noTablespace ) ) ahprintf(AH, "; Tablespace: %s", te->tablespace); ahprintf(AH, "\n"); diff -urN postgresql-8.2.4/src/bin/pg_dump/pg_dump.c postgresql-8.2.4-new/src/bin/pg_dump/pg_dump.c --- postgresql-8.2.4/src/bin/pg_dump/pg_dump.c 2007-04-16 14:42:17.000000000 -0400 +++ postgresql-8.2.4-new/src/bin/pg_dump/pg_dump.c 2007-07-15 13:17:21.000000000 -0400 @@ -217,6 +217,7 @@ int outputCreate = 0; bool outputBlobs = false; int outputNoOwner = 0; + static int outputNoTablespaces = 0; static int use_setsessauth = 0; static int disable_triggers = 0; char *outputSuperuser = NULL; @@ -261,7 +262,8 @@ {"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1}, {"disable-triggers", no_argument, &disable_triggers, 1}, {"use-set-session-authorization", no_argument, &use_setsessauth, 1}, - + {"no-tablespaces", no_argument, &outputNoTablespaces, 1}, + {NULL, 0, NULL, 0} }; int optindex; @@ -338,7 +340,7 @@ case 'F': format = optarg; break; - + case 'h': /* server host */ pghost = optarg; break; @@ -418,6 +420,8 @@ disable_triggers = 1; else if (strcmp(optarg, "use-set-session-authorization") == 0) use_setsessauth = 1; + else if (strcmp(optarg, "no-tablespaces") == 0) + outputNoTablespaces = 1; else { fprintf(stderr, @@ -699,6 +703,7 @@ ropt->superuser = outputSuperuser; ropt->create = outputCreate; ropt->noOwner = outputNoOwner; + ropt->noTablespace = outputNoTablespaces; ropt->disable_triggers = disable_triggers; ropt->use_setsessauth = use_setsessauth; ropt->dataOnly = dataOnly; @@ -762,7 +767,8 @@ printf(_(" --use-set-session-authorization\n" " use SESSION AUTHORIZATION commands instead of\n" " ALTER OWNER commands to set ownership\n")); - + printf(_(" --no-tablespaces do NOT dump tablespace assignments\n")); + printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port number\n")); diff -urN postgresql-8.2.4/src/bin/pg_dump/pg_dumpall.c postgresql-8.2.4-new/src/bin/pg_dump/pg_dumpall.c --- postgresql-8.2.4/src/bin/pg_dump/pg_dumpall.c 2006-11-21 17:19:46.000000000 -0500 +++ postgresql-8.2.4-new/src/bin/pg_dump/pg_dumpall.c 2007-07-15 13:17:21.000000000 -0400 @@ -66,6 +66,7 @@ static int disable_dollar_quoting = 0; static int disable_triggers = 0; static int use_setsessauth = 0; +static int no_tablespaces = 0; static int server_version; @@ -104,13 +105,13 @@ {"verbose", no_argument, NULL, 'v'}, {"no-privileges", no_argument, NULL, 'x'}, {"no-acl", no_argument, NULL, 'x'}, - /* * the following options don't have an equivalent short option letter */ {"disable-dollar-quoting", no_argument, &disable_dollar_quoting, 1}, {"disable-triggers", no_argument, &disable_triggers, 1}, {"use-set-session-authorization", no_argument, &use_setsessauth, 1}, + {"no-tablespaces", no_argument, &no_tablespaces, 1}, {NULL, 0, NULL, 0} }; @@ -258,6 +259,12 @@ appendPQExpBuffer(pgdumpopts, " --disable-dollar-quoting"); else if (strcmp(optarg, "disable-triggers") == 0) appendPQExpBuffer(pgdumpopts, " --disable-triggers"); + else if (strcmp(optarg, "no-tablespaces") == 0) + { + /* No tablespaces to be dumped out */ + no_tablespaces = 1; + appendPQExpBuffer(pgdumpopts, " --no-tablespaces"); + } else if (strcmp(optarg, "use-set-session-authorization") == 0) /* no-op, still allowed for compatibility */ ; else @@ -286,7 +293,9 @@ appendPQExpBuffer(pgdumpopts, " --disable-triggers"); if (use_setsessauth) appendPQExpBuffer(pgdumpopts, " --use-set-session-authorization"); - + if (no_tablespaces) + appendPQExpBuffer(pgdumpopts, " --no-tablespaces"); + if (optind < argc) { fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), @@ -342,7 +351,7 @@ dumpGroups(conn); /* Dump tablespaces */ - if (server_version >= 80000) + if ( (server_version >= 80000) && ( !no_tablespaces ) ) dumpTablespaces(conn); /* Dump CREATE DATABASE commands */ @@ -393,7 +402,8 @@ printf(_(" --use-set-session-authorization\n" " use SESSION AUTHORIZATION commands instead of\n" " OWNER TO commands\n")); - + printf(_(" --no-tablespaces do NOT dump tablespace assignments\n")); + printf(_("\nConnection options:\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port number\n"));