diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c
index 294f58b..be9519c 100644
--- a/contrib/pg_upgrade/pg_upgrade.c
+++ b/contrib/pg_upgrade/pg_upgrade.c
@@ -229,7 +229,7 @@ prepare_new_databases(void)
 	 *	Install support functions in the database accessed by
 	 *	GLOBALS_DUMP_FILE because it can preserve pg_authid.oid.
 	 */
-	install_support_functions_in_new_db(os_info.user);
+	install_support_functions_in_new_db("postgres");
 
 	/*
 	 * We have to create the databases first so we can install support
@@ -239,7 +239,7 @@ prepare_new_databases(void)
 			  SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
 	/* --no-psqlrc prevents AUTOCOMMIT=off */
 			  "--no-psqlrc --port %d --username \"%s\" "
-			  "-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
+			  "-f \"%s/%s\" --dbname postgres >> \"%s\"" SYSTEMQUOTE,
 			  new_cluster.bindir, new_cluster.port, os_info.user, os_info.cwd,
 			  GLOBALS_DUMP_FILE, log_opts.filename);
 	check_ok();
