Index: includes/database/pgsql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/schema.inc,v
retrieving revision 1.3
diff -u -p -r1.3 schema.inc
--- includes/database/pgsql/schema.inc	26 Nov 2008 13:42:25 -0000	1.3
+++ includes/database/pgsql/schema.inc	4 Dec 2008 04:35:45 -0000
@@ -506,4 +506,23 @@ class DatabaseSchema_pgsql extends Datab
       }
     }
   }
+
+  /**
+   * Find all tables that are like the specified base table name.
+   *
+   * @param $table_expression
+   *   An SQL expression, for example "simpletest%" (without the quotes).
+   *   BEWARE: this is not prefixed, the caller should take care of that.
+   * @return
+   *   Array, both the keys and the values are the matching tables.
+   */
+  public function findTables($table_expression) {
+    global $db_prefix;
+    $info = Database::getConnectionInfo();
+    $result = db_query("SELECT table_name FROM information_schema.tables WHERE table_catalog = :database AND table_name LIKE :table_name", array(
+      ':database' => $info['default']['database'],
+      ':table_name' => $table_expression,
+    ));
+    return $result->fetchAllKeyed(0, 0);
+  }
 }
