diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-12-06 08:48:15 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-12-06 08:48:15 -0500 |
commit | 68281e00540a29e7f9bfc154c25a78b875f560d1 (patch) | |
tree | edd65f9661d0efcdc11780cea0466c1f8aeb6715 /src/bin/scripts/droplang.c | |
parent | 6ef4ae1d4e829675c332c39895fdf90e15c3faeb (diff) |
Make command-line tools smarter about finding a DB to connect to.
If unable to connect to "postgres", try "template1". This allows things to
work more smoothly in the case where the postgres database has been
dropped. And just in case that's not good enough, also allow the user to
specify a maintenance database to be used for the initial connection, to
cover the case where neither postgres nor template1 is suitable.
Diffstat (limited to 'src/bin/scripts/droplang.c')
-rw-r--r-- | src/bin/scripts/droplang.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c index f136a760ff0..d04b4dd9733 100644 --- a/src/bin/scripts/droplang.c +++ b/src/bin/scripts/droplang.c @@ -131,7 +131,7 @@ main(int argc, char *argv[]) static const bool translate_columns[] = {false, true}; conn = connectDatabase(dbname, host, port, username, prompt_password, - progname); + progname, false); printfPQExpBuffer(&sql, "SELECT lanname as \"%s\", " "(CASE WHEN lanpltrusted THEN '%s' ELSE '%s' END) as \"%s\" " @@ -170,7 +170,8 @@ main(int argc, char *argv[]) if (*p >= 'A' && *p <= 'Z') *p += ('a' - 'A'); - conn = connectDatabase(dbname, host, port, username, prompt_password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, + progname, false); /* * Force schema search path to be just pg_catalog, so that we don't have |