mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Behave sanely when database name is omitted from command line.
This commit is contained in:
parent
fae92fba43
commit
5c48b253af
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.203 2001/04/22 21:34:13 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.204 2001/04/23 23:36:33 tgl Exp $
|
||||||
*
|
*
|
||||||
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
|
||||||
*
|
*
|
||||||
@ -948,6 +948,19 @@ main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the target database name */
|
||||||
|
if (optind < argc)
|
||||||
|
dbname = argv[optind];
|
||||||
|
else
|
||||||
|
dbname = getenv("PGDATABASE");
|
||||||
|
if (!dbname)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: no database name specified\n",
|
||||||
|
progname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (dataOnly && schemaOnly)
|
if (dataOnly && schemaOnly)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -1022,8 +1035,6 @@ main(int argc, char **argv)
|
|||||||
/* Let the archiver know how noisy to be */
|
/* Let the archiver know how noisy to be */
|
||||||
g_fout->verbose = g_verbose;
|
g_fout->verbose = g_verbose;
|
||||||
|
|
||||||
dbname = argv[optind];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the database using the Archiver, so it knows about it. Errors
|
* Open the database using the Archiver, so it knows about it. Errors
|
||||||
* mean death
|
* mean death
|
||||||
|
Loading…
x
Reference in New Issue
Block a user