Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5c48b25

Browse files
committed
Behave sanely when database name is omitted from command line.
1 parentfae92fb commit5c48b25

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
*
2424
* IDENTIFICATION
25-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.203 2001/04/22 21:34:13 tgl Exp $
25+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.204 2001/04/23 23:36:33 tgl Exp $
2626
*
2727
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2828
*
@@ -948,6 +948,19 @@ main(int argc, char **argv)
948948
exit(1);
949949
}
950950

951+
/* Get the target database name */
952+
if (optind<argc)
953+
dbname=argv[optind];
954+
else
955+
dbname=getenv("PGDATABASE");
956+
if (!dbname)
957+
{
958+
fprintf(stderr,
959+
"%s: no database name specified\n",
960+
progname);
961+
exit(1);
962+
}
963+
951964
if (dataOnly&&schemaOnly)
952965
{
953966
fprintf(stderr,
@@ -1022,8 +1035,6 @@ main(int argc, char **argv)
10221035
/* Let the archiver know how noisy to be */
10231036
g_fout->verbose=g_verbose;
10241037

1025-
dbname=argv[optind];
1026-
10271038
/*
10281039
* Open the database using the Archiver, so it knows about it. Errors
10291040
* mean death

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp