Index: date_api.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/date/date_api.module,v
retrieving revision 1.64.2.5.2.77
diff -u -r1.64.2.5.2.77 date_api.module
--- date_api.module	20 Mar 2009 15:03:49 -0000	1.64.2.5.2.77
+++ date_api.module	24 Mar 2009 01:26:38 -0000
@@ -1917,6 +1917,11 @@
 function _date_format_types_build() {
   $types = array();
 
+  // Prevent errors in the upgrade before the date_format_types table exists.
+  if (defined('MAINTENANCE_MODE') && !db_table_exists('date_format_types')) {
+    return $types;
+  }
+
   // Get list of modules which implement hook_date_format_types().
   $modules = module_implements('date_format_types');
 
@@ -1967,6 +1972,11 @@
 function _date_formats_build() {
   $date_formats = array();
 
+  // Prevent errors in the upgrade before the date_format table exists.
+  if (defined('MAINTENANCE_MODE') && !db_table_exists('date_format')) {
+    return $date_formats;
+  }
+
   // First handle hook_date_format_types().
   $types = _date_format_types_build();
   foreach ($types as $type => $info) {
