diff --git a/includes/update.inc b/includes/update.inc
index 30cfffdbdeb3636b13b014076e233ad7db7788d3..27fa80a3f3c83aa74ba96af4e22ecf183ca04f33 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -155,6 +155,20 @@ function update_prepare_d7_bootstrap() {
         'description' => $has_required_schema ? '' : 'Please update your Drupal 6 installation to the most recent version before attempting to upgrade to Drupal 7',
       ),
     );
+
+    // Make sure that the database environment is properly set up.
+    try {
+      db_run_tasks(db_driver());
+    }
+    catch (DatabaseTaskException $e) {
+      $requirements['database tasks'] = array(
+        'title' => 'Database environment',
+        'value' => 'There is a problem with your database environment',
+        'severity' => REQUIREMENT_ERROR,
+        'description' => $e->getMessage(),
+      );
+    }
+
     update_extra_requirements($requirements);
 
     // Allow a D6 session to work, since the upgrade has not been performed yet.
diff --git a/modules/system/system.install b/modules/system/system.install
index f31abcb5a71ce3d9e8a2eb932376bae721182502..c0796027b018030e5728c61c18bf21e553d2d8f0 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2114,21 +2114,6 @@ function system_update_7021() {
     ->execute();
 }
 
-/**
- * Add the substr_index() function to PostgreSQL.
- *
- * Note: this should go into the driver itself, but we have no support
- * for driver-specific updates yet.
- */
-function system_update_7024() {
-  if (db_driver() == 'pgsql') {
-    db_query('CREATE OR REPLACE FUNCTION "substring_index"(text, text, integer) RETURNS text AS
-      \'SELECT array_to_string((string_to_array($1, $2)) [1:$3], $2);\'
-      LANGUAGE \'sql\''
-    );
-  }
-}
-
 /**
  * Enable field type modules.
  */