throw DbException.get(ErrorCode.INDEX_NOT_FOUND_1, indexName);
}
} else {
Table table = index.getTable();
session.getUser().checkRight(index.getTable(), Right.ALL);
Constraint pkConstraint = null;
ArrayList<Constraint> constraints = table.getConstraints();
for (int i = 0; constraints != null && i < constraints.size(); i++) {
Constraint cons = constraints.get(i);
if (cons.usesIndex(index)) {
// can drop primary key index (for compatibility)
if (Constraint.PRIMARY_KEY.equals(cons.getConstraintType())) {
pkConstraint = cons;
} else {
throw DbException.get(ErrorCode.INDEX_BELONGS_TO_CONSTRAINT_1, indexName);
}
}