How to remove a unique key in an update hook
All of the core schema classes (mysql, pgsql &amp; sqlite) check for the existence of the constraint before actually dropping, so you don't have to check yourself. If you do you're actually doubling up on a DB op unnecessarily.

To cover all eventualities your code could look something like this:

try {
  if (db_drop_unique_key($table, $name)) {
    // Constraint was found and removed.
  }
  else {
    // Constraint was not found, nothing was altered.
  }
}
catch (PDOException $e) {
  // Constraint was found, but something went wrong, see $e-&gt;getMessage() for more info.
  throw new DrupalUpdateException($e-&gt;getMessage);
}


Incidentally, a unique constraint is treated the same as an index by the core schema classes, so db_index_exists() can be used to check for them too.