<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.38 2003/03/24 14:32:51 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.39 2003/05/30 23:55:10 tgl Exp $
PostgreSQL documentation
-->
<application>pg_dumpall</application> also dumps global objects
that are common to all databases.
(<application>pg_dump</application> does not save these objects.)
- This currently includes the information about database users and
- groups.
+ This currently includes information about database users and
+ groups, and access permissions that apply to databases as a whole.
</para>
<para>
<title>Options</title>
<para>
- The following command-line options are used to control the output format.
+ The following command-line options are used to control the content and
+ format of the output.
<variablelist>
<varlistentry>
+ <term><option>-a</></term>
+ <term><option>--data-only</></term>
+ <listitem>
+ <para>
+ Dump only the data, not the schema (data definitions).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-c</option></term>
<term><option>--clean</option></term>
<listitem>
</varlistentry>
<varlistentry>
+ <term><option>-s</option></term>
+ <term><option>--schema-only</option></term>
+ <listitem>
+ <para>
+ Dump only the schema (data definitions), no data.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-v</></term>
<term><option>--verbose</></term>
<listitem>
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>-x</></term>
+ <term><option>--no-privileges</></term>
+ <term><option>--no-acl</></term>
+ <listitem>
+ <para>
+ Prevent dumping of access privileges (grant/revoke commands).
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</para>
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.19 2003/05/30 22:55:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.20 2003/05/30 23:55:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
char *pgdumploc;
PQExpBuffer pgdumpopts;
bool output_clean = false;
+bool skip_acls = false;
bool verbose = false;
int server_version;
char *pgport = NULL;
char *pguser = NULL;
bool force_password = false;
+ bool data_only = false;
bool globals_only = false;
+ bool schema_only = false;
PGconn *conn;
int c;
static struct option long_options[] = {
+ {"data-only", no_argument, NULL, 'a'},
{"clean", no_argument, NULL, 'c'},
{"inserts", no_argument, NULL, 'd'},
{"attribute-inserts", no_argument, NULL, 'D'},
{"oids", no_argument, NULL, 'o'},
{"port", required_argument, NULL, 'p'},
{"password", no_argument, NULL, 'W'},
+ {"schema-only", no_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'},
{NULL, 0, NULL, 0}
};
pgdumploc = findPgDump(argv[0]);
pgdumpopts = createPQExpBuffer();
- while ((c = getopt_long(argc, argv, "cdDgh:iop:U:vW", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "acdDgh:iop:sU:vWx", long_options, &optindex)) != -1)
{
switch (c)
{
+ case 'a':
+ data_only = true;
+ appendPQExpBuffer(pgdumpopts, " -a");
+ break;
+
case 'c':
output_clean = true;
break;
appendPQExpBuffer(pgdumpopts, " -p '%s'", pgport);
break;
+ case 's':
+ schema_only = true;
+ appendPQExpBuffer(pgdumpopts, " -s");
+ break;
+
case 'U':
pguser = optarg;
appendPQExpBuffer(pgdumpopts, " -U '%s'", pguser);
appendPQExpBuffer(pgdumpopts, " -W");
break;
+ case 'x':
+ skip_acls = true;
+ appendPQExpBuffer(pgdumpopts, " -x");
+ break;
+
default:
fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
exit(1);
printf("--\n\n");
printf("\\connect \"template1\"\n\n");
- dumpUsers(conn);
- dumpGroups(conn);
-
- if (globals_only)
- goto end;
+ if (!data_only)
+ {
+ dumpUsers(conn);
+ dumpGroups(conn);
+ }
- dumpCreateDB(conn);
- dumpDatabases(conn);
+ if (!globals_only)
+ {
+ if (!data_only)
+ dumpCreateDB(conn);
+ dumpDatabases(conn);
+ }
-end:
PQfinish(conn);
exit(0);
}
printf(_(" %s [OPTION]...\n"), progname);
printf(_("\nOptions:\n"));
+ printf(_(" -a, --data-only dump only the data, not the schema\n"));
printf(_(" -c, --clean clean (drop) databases prior to create\n"));
printf(_(" -d, --inserts dump data as INSERT, rather than COPY, commands\n"));
printf(_(" -D, --column-inserts dump data as INSERT commands with column names\n"));
printf(_(" -g, --globals-only dump only global objects, no databases\n"));
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(_(" -o, --oids include OIDs in dump\n"));
printf(_(" -v, --verbose verbose mode\n"));
+ printf(_(" -x, --no-privileges do not dump privileges (grant/revoke)\n"));
printf(_(" --help show this help, then exit\n"));
printf(_(" --version output version information, then exit\n"));
appendPQExpBuffer(buf, ";\n");
}
- if (!buildACLCommands(fdbname, "DATABASE", dbacl, dbowner,
+ if (!skip_acls &&
+ !buildACLCommands(fdbname, "DATABASE", dbacl, dbowner,
server_version, buf))
{
fprintf(stderr, _("%s: could not parse ACL list (%s) for database %s\n"),