@@ -52,9 +52,6 @@ static void set_frozenxids(void);
5252static void setup (char * argv0 ,bool live_check );
5353static void cleanup (void );
5454
55- /* This is the database used by pg_dumpall to restore global tables */
56- #define GLOBAL_DUMP_DB "postgres"
57-
5855ClusterInfo old_cluster ,
5956new_cluster ;
6057OSInfo os_info ;
@@ -233,10 +230,12 @@ prepare_new_databases(void)
233230prep_status ("Creating databases in the new cluster" );
234231
235232/*
236- * Install support functions in the global-restore database to preserve
237- * pg_authid.oid.
233+ * Install support functions in the global-object restore database to
234+ * preserve pg_authid.oid. pg_dumpall uses 'template0' as its template
235+ * database so objects we add into 'template1' are not propogated. They
236+ * are removed on pg_upgrade exit.
238237 */
239- install_support_functions_in_new_db (GLOBAL_DUMP_DB );
238+ install_support_functions_in_new_db ("template1" );
240239
241240/*
242241 * We have to create the databases first so we can install support
@@ -270,7 +269,7 @@ create_new_objects(void)
270269DbInfo * new_db = & new_cluster .dbarr .dbs [dbnum ];
271270
272271/* skip db we already installed */
273- if (strcmp (new_db -> db_name ,GLOBAL_DUMP_DB )!= 0 )
272+ if (strcmp (new_db -> db_name ,"template1" )!= 0 )
274273install_support_functions_in_new_db (new_db -> db_name );
275274}
276275check_ok ();