]> granicus.if.org Git - postgresql/commitdiff
In pg_upgrade, clarify use of install_db_support_functions().
authorBruce Momjian <bruce@momjian.us>
Sat, 8 Jan 2011 14:11:48 +0000 (09:11 -0500)
committerBruce Momjian <bruce@momjian.us>
Sat, 8 Jan 2011 14:11:48 +0000 (09:11 -0500)
contrib/pg_upgrade/function.c
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/pg_upgrade.h

index e8502e2bb2ae412c55778414827607e8b14c93c0..cb9576aff4ef6bc63be05112e5413cf0e1557b02 100644 (file)
 
 
 /*
- * install_db_support_functions()
+ * install_support_functions_in_db()
  *
  * pg_upgrade requires some support functions that enable it to modify
  * backend behavior.
  */
 void
-install_db_support_functions(const char *db_name)
+install_support_functions_in_db(const char *db_name)
 {
        PGconn *conn = connectToServer(&new_cluster, db_name);
        
index 331ade1076f6b33818c3baff965b1368f46d46ff..a428a038bca541c9c349f7a6498acc6787c96df4 100644 (file)
@@ -225,8 +225,11 @@ prepare_new_databases(void)
 
        prep_status("Creating databases in the new cluster");
 
-       /* install support functions in the database used by GLOBALS_DUMP_FILE */
-       install_db_support_functions(os_info.user);
+       /*
+        *      Install support functions in the database accessed by
+        *      GLOBALS_DUMP_FILE because it can preserve pg_authid.oid.
+        */
+       install_support_functions_in_db(os_info.user);
 
        /*
         * We have to create the databases first so we can install support
@@ -261,7 +264,9 @@ create_new_objects(void)
        {
                DbInfo     *new_db = &new_cluster.dbarr.dbs[dbnum];
 
-               install_db_support_functions(new_db->db_name);
+               /* skip db we already installed */
+               if (strcmp(new_db->db_name, os_info.user) != 0)
+                       install_support_functions_in_db(new_db->db_name);
        }
        check_ok();
 
index 95db4dd161a0ac98d90c053c8bf518c3676109df..acd453b8954b66c61d9bd264d133c01ca30191a2 100644 (file)
@@ -321,7 +321,7 @@ void                check_hard_link(void);
 
 /* function.c */
 
-void           install_db_support_functions(const char *db_name);
+void           install_support_functions_in_db(const char *db_name);
 void           uninstall_support_functions(void);
 void           get_loadable_libraries(void);
 void           check_loadable_libraries(void);