/** Check that all views and other dependent objects. */ private void checkViews(SchemaObject sourceTable, SchemaObject newTable) { String sourceTableName = sourceTable.getName(); String newTableName = newTable.getName(); Database db = sourceTable.getDatabase(); // save the real table under a temporary name String temp = db.getTempTableName(sourceTableName, session); db.renameSchemaObject(session, sourceTable, temp); try { // have our new table impersonate the target table db.renameSchemaObject(session, newTable, sourceTableName); checkViewsAreValid(sourceTable); } finally { // always put the source tables back with their proper names try { db.renameSchemaObject(session, newTable, newTableName); } finally { db.renameSchemaObject(session, sourceTable, sourceTableName); } } }