diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
new file mode 100644
index 617270f..e7bf48a
*** a/src/bin/pg_upgrade/check.c
--- b/src/bin/pg_upgrade/check.c
*************** check_for_isn_and_int8_passing_mismatch(
*** 858,864 ****
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "Database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s\n",
--- 858,864 ----
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "In database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s\n",
*************** check_for_tables_with_oids(ClusterInfo *
*** 937,943 ****
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "Database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s\n",
--- 937,943 ----
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "In database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s\n",
*************** check_for_reg_data_type_usage(ClusterInf
*** 1046,1052 ****
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "Database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
--- 1046,1052 ----
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "In database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
*************** check_for_jsonb_9_4_usage(ClusterInfo *c
*** 1137,1143 ****
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "Database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
--- 1137,1143 ----
  						 output_path, strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "In database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c
new file mode 100644
index 0c66d1c..3cbaab6
*** a/src/bin/pg_upgrade/function.c
--- b/src/bin/pg_upgrade/function.c
*************** check_loadable_libraries(void)
*** 256,262 ****
  		}
  
  		if (was_load_failure)
! 			fprintf(script, _("Database: %s\n"),
  					old_cluster.dbarr.dbs[os_info.libraries[libnum].dbnum].db_name);
  	}
  
--- 256,262 ----
  		}
  
  		if (was_load_failure)
! 			fprintf(script, _("In database: %s\n"),
  					old_cluster.dbarr.dbs[os_info.libraries[libnum].dbnum].db_name);
  	}
  
diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c
new file mode 100644
index 10cb362..42f1ce7
*** a/src/bin/pg_upgrade/version.c
--- b/src/bin/pg_upgrade/version.c
*************** old_9_3_check_for_line_data_type_usage(C
*** 157,163 ****
  						 strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "Database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
--- 157,163 ----
  						 strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "In database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
*************** old_9_6_check_for_unknown_data_type_usag
*** 258,264 ****
  						 strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "Database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
--- 258,264 ----
  						 strerror(errno));
  			if (!db_used)
  			{
! 				fprintf(script, "In database: %s\n", active_db->db_name);
  				db_used = true;
  			}
  			fprintf(script, "  %s.%s.%s\n",
