aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/scripts')
-rw-r--r--src/bin/scripts/clusterdb.c4
-rw-r--r--src/bin/scripts/createdb.c5
-rw-r--r--src/bin/scripts/createuser.c4
-rw-r--r--src/bin/scripts/dropdb.c5
-rw-r--r--src/bin/scripts/dropuser.c4
-rw-r--r--src/bin/scripts/vacuumdb.c4
6 files changed, 14 insertions, 12 deletions
diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c
index 4b5bc6f15fb..3ab0be575ed 100644
--- a/src/bin/scripts/clusterdb.c
+++ b/src/bin/scripts/clusterdb.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 2002-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.12 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.13 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -207,7 +207,7 @@ cluster_all_databases(const char *host, const char *port,
PGresult *result;
int i;
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn;", progname, echo);
PQfinish(conn);
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c
index f85e4e84fee..1585523ab9c 100644
--- a/src/bin/scripts/createdb.c
+++ b/src/bin/scripts/createdb.c
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.14 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.15 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -157,7 +157,8 @@ main(int argc, char *argv[])
appendPQExpBuffer(&sql, " TEMPLATE %s", fmtId(template));
appendPQExpBuffer(&sql, ";\n");
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
+ host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c
index 67758e00d79..db85837952d 100644
--- a/src/bin/scripts/createuser.c
+++ b/src/bin/scripts/createuser.c
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.16 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.17 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -209,7 +209,7 @@ main(int argc, char *argv[])
appendPQExpBuffer(&sql, " NOCREATEUSER");
appendPQExpBuffer(&sql, ";\n");
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c
index d58ffcb4eff..944c68dbe33 100644
--- a/src/bin/scripts/dropdb.c
+++ b/src/bin/scripts/dropdb.c
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.14 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.15 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -117,7 +117,8 @@ main(int argc, char *argv[])
appendPQExpBuffer(&sql, "DROP DATABASE %s;\n",
fmtId(dbname));
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres",
+ host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
diff --git a/src/bin/scripts/dropuser.c b/src/bin/scripts/dropuser.c
index 343cae39b8d..32aa83557a6 100644
--- a/src/bin/scripts/dropuser.c
+++ b/src/bin/scripts/dropuser.c
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.13 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.14 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,7 +116,7 @@ main(int argc, char *argv[])
initPQExpBuffer(&sql);
appendPQExpBuffer(&sql, "DROP USER %s;\n", fmtId(dropuser));
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
if (echo)
printf("%s", sql.data);
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index 2015e44242c..8998d5da6c7 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.12 2004/12/31 22:03:17 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.13 2005/06/21 04:02:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -233,7 +233,7 @@ vacuum_all_databases(bool full, bool verbose, bool analyze,
PGresult *result;
int i;
- conn = connectDatabase("template1", host, port, username, password, progname);
+ conn = connectDatabase("postgres", host, port, username, password, progname);
result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn;", progname, echo);
PQfinish(conn);