aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/dropdb.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2011-05-10 19:44:15 -0400
committerBruce Momjian <bruce@momjian.us>2011-05-10 19:44:47 -0400
commit7ff7711919287a93f348023d77f9611633c9627c (patch)
tree2a84c9212231cc966dbaa013665438f67f03eb26 /src/bin/scripts/dropdb.c
parent87631ac98df2e32cac22ddee7b9c37813ff3b161 (diff)
downloadpostgresql-7ff7711919287a93f348023d77f9611633c9627c.tar.gz
postgresql-7ff7711919287a93f348023d77f9611633c9627c.zip
For create/dropdb, only connect once to the server since we now have a
shared description table for pg_database comments. Also update comments about database name selection.
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);