Index: doc/src/sgml/ref/pg_dumpall.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v
retrieving revision 1.58
diff -c -r1.58 pg_dumpall.sgml
*** doc/src/sgml/ref/pg_dumpall.sgml 7 Oct 2006 20:59:04 -0000 1.58
--- doc/src/sgml/ref/pg_dumpall.sgml 12 Jan 2007 14:01:10 -0000
***************
*** 130,140 ****
!
!
! Dump only global objects (users and groups), no databases.
--- 130,145 ----
!
!
! Dump only global objects (roles and/or tablespaces), no databases.
! The r parameter will
! cause only roles to be dumped, and the
! t parameter will cause
! only tablespaces to be dumped. If no parameter is specified, all
! global object types will be dumped.
Index: src/bin/pg_dump/pg_dumpall.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v
retrieving revision 1.86
diff -c -r1.86 pg_dumpall.c
*** src/bin/pg_dump/pg_dumpall.c 5 Jan 2007 22:19:48 -0000 1.86
--- src/bin/pg_dump/pg_dumpall.c 12 Jan 2007 14:01:12 -0000
***************
*** 78,83 ****
--- 78,85 ----
bool force_password = false;
bool data_only = false;
bool globals_only = false;
+ bool roles_only = false;
+ bool tablespaces_only = false;
bool schema_only = false;
PGconn *conn;
int encoding;
***************
*** 91,97 ****
{"inserts", no_argument, NULL, 'd'},
{"attribute-inserts", no_argument, NULL, 'D'},
{"column-inserts", no_argument, NULL, 'D'},
! {"globals-only", no_argument, NULL, 'g'},
{"host", required_argument, NULL, 'h'},
{"ignore-version", no_argument, NULL, 'i'},
{"oids", no_argument, NULL, 'o'},
--- 93,99 ----
{"inserts", no_argument, NULL, 'd'},
{"attribute-inserts", no_argument, NULL, 'D'},
{"column-inserts", no_argument, NULL, 'D'},
! {"globals-only", optional_argument, NULL, 'g'},
{"host", required_argument, NULL, 'h'},
{"ignore-version", no_argument, NULL, 'i'},
{"oids", no_argument, NULL, 'o'},
***************
*** 161,167 ****
pgdumpopts = createPQExpBuffer();
! while ((c = getopt_long(argc, argv, "acdDgh:ioOp:sS:U:vWxX:", long_options, &optindex)) != -1)
{
switch (c)
{
--- 163,169 ----
pgdumpopts = createPQExpBuffer();
! while ((c = getopt_long(argc, argv, "acdDg::h:ioOp:sS:U:vWxX:", long_options, &optindex)) != -1)
{
switch (c)
{
***************
*** 181,186 ****
--- 183,203 ----
case 'g':
globals_only = true;
+ if (optarg)
+ {
+ if (strcmp(optarg, "r") == 0)
+ roles_only = true;
+ else if (strcmp(optarg, "t") == 0)
+ tablespaces_only = true;
+ else
+ {
+ fprintf(stderr,
+ _("%s: invalid -g option -- %s\n"),
+ progname, optarg);
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+ exit(1);
+ }
+ }
break;
case 'h':
***************
*** 332,349 ****
printf("SET escape_string_warning = 'off';\n");
printf("\n");
! /* Dump roles (users) */
! dumpRoles(conn);
! /* Dump role memberships --- need different method for pre-8.1 */
! if (server_version >= 80100)
! dumpRoleMembership(conn);
! else
! dumpGroups(conn);
! /* Dump tablespaces */
! if (server_version >= 80000)
! dumpTablespaces(conn);
/* Dump CREATE DATABASE commands */
if (!globals_only)
--- 349,372 ----
printf("SET escape_string_warning = 'off';\n");
printf("\n");
! if (!tablespaces_only)
! {
! /* Dump roles (users) */
! dumpRoles(conn);
! /* Dump role memberships --- need different method for pre-8.1 */
! if (server_version >= 80100)
! dumpRoleMembership(conn);
! else
! dumpGroups(conn);
! }
! if (!roles_only)
! {
! /* Dump tablespaces */
! if (server_version >= 80000)
! dumpTablespaces(conn);
! }
/* Dump CREATE DATABASE commands */
if (!globals_only)
***************
*** 381,387 ****
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(_(" -o, --oids include OIDs in dump\n"));
printf(_(" -O, --no-owner skip restoration of object ownership\n"));
printf(_(" -s, --schema-only dump only the schema, no data\n"));
--- 404,410 ----
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=[r|t] dump only global objects, no databases. Optionally restrict to roles or tablespaces\n"));
printf(_(" -o, --oids include OIDs in dump\n"));
printf(_(" -O, --no-owner skip restoration of object ownership\n"));
printf(_(" -s, --schema-only dump only the schema, no data\n"));