diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index befd73ba66..efc35f7514 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -1,5 +1,5 @@
@@ -176,6 +176,25 @@ PostgreSQL documentation
+
+
+
+
+
+ Do not output commands to set
+ ownership of objects to match the original database.
+ By default, pg_dumpall issues
+ SET SESSION AUTHORIZATION
+ statements to set ownership of created schema elements.
+ These statements
+ will fail when the script is run unless it is started by a superuser
+ (or the same user that owns all of the objects in the script).
+ To make a script that can be restored by any user, but will give
+ that user ownership of all the objects, specify
+
+
+
@@ -186,6 +205,19 @@ PostgreSQL documentation
+
+
+
+
+
+ Specify the superuser user name to use when disabling triggers.
+ This is only relevant if
+
+
+
@@ -209,6 +241,50 @@ PostgreSQL documentation
+
+
+
+
+
+
+ This option disables the use of dollar quoting for function bodies,
+ and forces them to be quoted using SQL standard string syntax.
+
+
+
+
+
+
+
+
+
+ This option is only relevant when creating a data-only dump.
+ It instructs pg_dumpall to include commands
+ to temporarily disable triggers on the target tables while
+ the data is reloaded. Use this if you have referential
+ integrity checks or other triggers on the tables that you
+ do not want to invoke during data reload.
+
+
+
+ Presently, the commands emitted for
+
+
+
+
+
+
+
+
+ This option is obsolete but still accepted for backwards
+ compatibility with pg_dump.
+
+
+
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 4f1270f084..d24d6dbeec 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.43 2004/06/21 13:36:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.44 2004/07/12 14:35:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,6 @@ static PGconn *connectDatabase(const char *dbname, const char *pghost, const cha
const char *pguser, bool require_password);
static PGresult *executeQuery(PGconn *conn, const char *query);
-
char pg_dump_bin[MAXPGPATH];
PQExpBuffer pgdumpopts;
bool output_clean = false;
@@ -67,7 +66,10 @@ bool skip_acls = false;
bool verbose = false;
int server_version;
-
+/* flags for -X long options */
+int disable_dollar_quoting = 0;
+int disable_triggers = 0;
+int use_setsessauth = 0;
int
main(int argc, char *argv[])
@@ -92,13 +94,24 @@ main(int argc, char *argv[])
{"host", required_argument, NULL, 'h'},
{"ignore-version", no_argument, NULL, 'i'},
{"oids", no_argument, NULL, 'o'},
+ {"no-owner", no_argument, NULL, 'O'},
{"port", required_argument, NULL, 'p'},
{"password", no_argument, NULL, 'W'},
{"schema-only", no_argument, NULL, 's'},
+ {"superuser", required_argument, NULL, 'S'},
{"username", required_argument, NULL, 'U'},
{"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, but are available as '-X long-name'
+ */
+ {"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},
+
{NULL, 0, NULL, 0}
};
@@ -142,7 +155,7 @@ main(int argc, char *argv[])
pgdumpopts = createPQExpBuffer();
- while ((c = getopt_long(argc, argv, "acdDgh:iop:sU:vWx", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "acdDgh:ioOp:sS:U:vWxX:", long_options, &optindex)) != -1)
{
switch (c)
{
@@ -174,6 +187,10 @@ main(int argc, char *argv[])
appendPQExpBuffer(pgdumpopts, " -%c", c);
break;
+ case 'O':
+ appendPQExpBuffer(pgdumpopts, " -O");
+ break;
+
case 'p':
pgport = optarg;
appendPQExpBuffer(pgdumpopts, " -p '%s'", pgport);
@@ -184,6 +201,10 @@ main(int argc, char *argv[])
appendPQExpBuffer(pgdumpopts, " -s");
break;
+ case 'S':
+ appendPQExpBuffer(pgdumpopts, " -S '%s'", optarg);
+ break;
+
case 'U':
pguser = optarg;
appendPQExpBuffer(pgdumpopts, " -U '%s'", pguser);
@@ -204,12 +225,40 @@ main(int argc, char *argv[])
appendPQExpBuffer(pgdumpopts, " -x");
break;
+ case 'X':
+ if (strcmp(optarg, "disable-dollar-quoting") == 0)
+ appendPQExpBuffer(pgdumpopts, " -X disable-dollar-quoting");
+ else if (strcmp(optarg, "disable-triggers") == 0)
+ appendPQExpBuffer(pgdumpopts, " -X disable-triggers");
+ else if (strcmp(optarg, "use-set-session-authorization") == 0)
+ /* no-op, still allowed for compatibility */ ;
+ else
+ {
+ fprintf(stderr,
+ _("%s: invalid -X option -- %s\n"),
+ progname, optarg);
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+ exit(1);
+ }
+ break;
+
+ case 0:
+ break;
+
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
exit(1);
}
}
+ /* Add long options to the pg_dump argument list */
+ if (disable_dollar_quoting)
+ appendPQExpBuffer(pgdumpopts, " -X disable-dollar-quoting");
+ if (disable_triggers)
+ appendPQExpBuffer(pgdumpopts, " -X disable-triggers");
+ if (use_setsessauth)
+ /* no-op, still allowed for compatibility */ ;
+
if (optind < argc)
{
fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"),
@@ -270,9 +319,15 @@ help(void)
printf(_(" -i, --ignore-version proceed even when server version mismatches\n"
" pg_dumpall version\n"));
printf(_(" -s, --schema-only dump only the schema, no data\n"));
+ printf(_(" -S, --superuser=NAME specify the superuser user name to use in the dump\n"));
printf(_(" -o, --oids include OIDs in dump\n"));
+ printf(_(" -O, --no-owner do not output commands to set object ownership\n"));
printf(_(" -v, --verbose verbose mode\n"));
printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n"));
+ printf(_(" -X disable-dollar-quoting, --disable-dollar-quoting\n"
+ " disable dollar quoting, use SQL standard quoting\n"));
+ printf(_(" -X disable-triggers, --disable-triggers\n"
+ " disable triggers during data-only restore\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --version output version information, then exit\n"));