diff -c -r pgsql.orig/doc/src/sgml/ref/pg_dumpall.sgml pgsql/doc/src/sgml/ref/pg_dumpall.sgml *** pgsql.orig/doc/src/sgml/ref/pg_dumpall.sgml Mon Jan 15 13:26:07 2007 --- pgsql/doc/src/sgml/ref/pg_dumpall.sgml Mon Jan 15 21:06:23 2007 *************** *** 312,318 **** --- 312,332 ---- + -E dbname + --default-database=dbname + + + Specifies the name of the database to connect to to dump global + objects and discover what other databases should be dumped. If + not specified, the postgres database will be used, + and if that does not exist, template1 will be used. + + + + + -h host + --host=host Specifies the host name of the machine on which the database *************** *** 326,331 **** --- 340,346 ---- -p port + --port=port Specifies the TCP port or local Unix domain socket file *************** *** 338,343 **** --- 353,359 ---- -U username + --username=username Connect as the given user. *************** *** 347,352 **** --- 363,369 ---- -W + --password Force a password prompt. This should happen automatically if diff -c -r pgsql.orig/src/bin/pg_dump/pg_dumpall.c pgsql/src/bin/pg_dump/pg_dumpall.c *** pgsql.orig/src/bin/pg_dump/pg_dumpall.c Mon Jan 15 13:26:07 2007 --- pgsql/src/bin/pg_dump/pg_dumpall.c Mon Jan 15 20:58:25 2007 *************** *** 75,80 **** --- 75,81 ---- char *pghost = NULL; char *pgport = NULL; char *pguser = NULL; + char *pgdb = NULL; bool force_password = false; bool data_only = false; bool globals_only = false; *************** *** 93,98 **** --- 94,100 ---- {"inserts", no_argument, NULL, 'd'}, {"attribute-inserts", no_argument, NULL, 'D'}, {"column-inserts", no_argument, NULL, 'D'}, + {"default-database", required_argument, NULL, 'E'}, {"globals-only", no_argument, NULL, 'g'}, {"host", required_argument, NULL, 'h'}, {"ignore-version", no_argument, NULL, 'i'}, *************** *** 165,171 **** pgdumpopts = createPQExpBuffer(); ! while ((c = getopt_long(argc, argv, "acdDgh:ioOp:rsS:tU:vWxX:", long_options, &optindex)) != -1) { switch (c) { --- 167,173 ---- pgdumpopts = createPQExpBuffer(); ! while ((c = getopt_long(argc, argv, "acdDE:gh:ioOp:rsS:tU:vWxX:", long_options, &optindex)) != -1) { switch (c) { *************** *** 182,187 **** --- 184,193 ---- case 'D': appendPQExpBuffer(pgdumpopts, " -%c", c); break; + + case 'E': + pgdb = optarg; + break; case 'g': globals_only = true; *************** *** 337,351 **** } /* ! * First try to connect to database "postgres", and failing that * "template1". "postgres" is the preferred choice for 8.1 and later * servers, but it usually will not exist on older ones. */ ! conn = connectDatabase("postgres", pghost, pgport, pguser, force_password, false); ! if (!conn) ! conn = connectDatabase("template1", pghost, pgport, pguser, ! force_password, true); /* * Get the active encoding and the standard_conforming_strings setting, so --- 343,382 ---- } /* ! * If there was a database specified on the command line, use that, ! * otherwise try to connect to database "postgres", and failing that * "template1". "postgres" is the preferred choice for 8.1 and later * servers, but it usually will not exist on older ones. */ ! if (pgdb) ! { ! conn = connectDatabase(pgdb, pghost, pgport, pguser, ! force_password, false); ! ! if (!conn) ! { ! fprintf(stderr, _("%s: could not connect to database \"%s\"\n"), ! progname, pgdb); ! exit(1); ! } ! } ! else ! { ! conn = connectDatabase("postgres", pghost, pgport, pguser, force_password, false); ! if (!conn) ! conn = connectDatabase("template1", pghost, pgport, pguser, ! force_password, true); ! ! if (!conn) ! { ! fprintf(stderr, _("%s: could not connect to databases \"postgres\" or \"template1\". Please specify an alternative database\n"), ! progname); ! fprintf(stderr, _("Try \"%s --help\" for more information.\n"), ! progname); ! exit(1); ! } ! } /* * Get the active encoding and the standard_conforming_strings setting, so *************** *** 443,448 **** --- 474,481 ---- " OWNER TO commands\n")); printf(_("\nConnection options:\n")); + printf(_(" -E,--default-database=dbname\n" + " specify an alternate default database\n")); printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port number\n")); printf(_(" -U, --username=NAME connect as specified database user\n"));