aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/dropdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/scripts/dropdb.c')
-rw-r--r--src/bin/scripts/dropdb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c
index 1cf18fd5d89..48f73ae25e8 100644
--- a/src/bin/scripts/dropdb.c
+++ b/src/bin/scripts/dropdb.c
@@ -113,6 +113,11 @@ main(int argc, char *argv[])
appendPQExpBuffer(&sql, "DROP DATABASE %s;\n",
fmtId(dbname));
+ /*
+ * Connect to the 'postgres' database by default, except have
+ * the 'postgres' user use 'template1' so he can drop the
+ * 'postgres' database.
+ */
conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
host, port, username, prompt_password, progname);