private boolean checkNewUniqueIndex ( Index newIndex ) { Table table = ( Table ) newIndex . getParent ( ) ; CatalogMap < Index > existingIndexes = m_originalIndexesByTable . get ( table . getTypeName ( ) ) ; for ( Index existingIndex : existingIndexes ) { if ( indexCovers ( newIndex , existingIndex ) ) { return true ; } } return false ; }
Check if there is a unique index that exists in the old catalog that is covered by the new index . That would mean adding this index can t fail with a duplicate key .