Program: 79991
Project: 79991
Buggy source:
/** 
 * Workhorse for dropping a column from a table. This routine drops a column from a table, taking care to properly handle the various related schema objects. The syntax which gets you here is: ALTER TABLE tbl DROP [COLUMN] col [CASCADE|RESTRICT] The keyword COLUMN is optional, and if you don't specify CASCADE or RESTRICT, the default is CASCADE (the default is chosen in the parser, not here). If you specify RESTRICT, then the column drop should be rejected if it would cause a dependent schema object to become invalid. If you specify CASCADE, then the column drop should additionally drop other schema objects which have become invalid. You may not drop the last (only) column in a table. Schema objects of interest include: - views - triggers - constraints - check constraints - primary key constraints - foreign key constraints - unique key constraints - not null constraints - privileges - indexes - default values Dropping a column may also change the column position numbers of other columns in the table, which may require fixup of schema objects (such as triggers and column privileges) which refer to columns by column position number. Indexes are a bit interesting. The official SQL spec doesn't talk about indexes; they are considered to be an imlementation-specific performance optimization. The current Derby behavior is that: - CASCADE/RESTRICT doesn't matter for indexes - when a column is dropped, it is removed from any indexes which contain it. - if that column was the only column in the index, the entire index is dropped. 
 * @param columnName the name of the column specfication in the ALTER statement-- currently we allow only one.
 * @exception StandardException 	thrown on failure.
 */
private void dropColumnFromTable(String columnName) throws StandardException {
  boolean cascade=(behavior == StatementType.DROP_CASCADE);
  ColumnDescriptorList generatedColumnList=td.getGeneratedColumns();
  int generatedColumnCount=generatedColumnList.size();
  ArrayList cascadedDroppedColumns=new ArrayList();
  for (int i=0; i < generatedColumnCount; i++) {
    ColumnDescriptor generatedColumn=generatedColumnList.elementAt(i);
    String[] referencedColumnNames=generatedColumn.getDefaultInfo().getReferencedColumnNames();
    int referencedColumnCount=referencedColumnNames.length;
    for (int j=0; j < referencedColumnCount; j++) {
      if (columnName.equals(referencedColumnNames[j])) {
        String generatedColumnName=generatedColumn.getColumnName();
        if (!cascade) {
          throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",generatedColumnName);
        }
 else {
          cascadedDroppedColumns.add(generatedColumnName);
        }
      }
    }
  }
  DataDescriptorGenerator ddg=dd.getDataDescriptorGenerator();
  int cascadedDrops=cascadedDroppedColumns.size();
  int sizeAfterCascadedDrops=td.getColumnDescriptorList().size() - cascadedDrops;
  if (sizeAfterCascadedDrops == 1) {
    throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),"String_Node_Str" + columnName,"String_Node_Str",td.getQualifiedName());
  }
  for (int i=0; i < cascadedDrops; i++) {
    String generatedColumnName=(String)cascadedDroppedColumns.get(i);
    activation.addWarning(StandardException.newWarning(SQLState.LANG_GEN_COL_DROPPED,generatedColumnName,td.getName()));
    dropColumnFromTable(generatedColumnName);
  }
  td=dd.getTableDescriptor(tableId);
  ColumnDescriptor columnDescriptor=td.getColumnDescriptor(columnName);
  if (columnDescriptor == null) {
    throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND_IN_TABLE,columnName,td.getQualifiedName());
  }
  int size=td.getColumnDescriptorList().size();
  droppedColumnPosition=columnDescriptor.getPosition();
  FormatableBitSet toDrop=new FormatableBitSet(size + 1);
  toDrop.set(droppedColumnPosition);
  td.setReferencedColumnMap(toDrop);
  dm.invalidateFor(td,(cascade ? DependencyManager.DROP_COLUMN : DependencyManager.DROP_COLUMN_RESTRICT),lcc);
  if (columnDescriptor.getDefaultInfo() != null) {
    dm.clearDependencies(lcc,columnDescriptor.getDefaultDescriptor(dd));
  }
  GenericDescriptorList tdl=dd.getTriggerDescriptors(td);
  for (Iterator descIter=tdl.iterator(); descIter.hasNext(); ) {
    TriggerDescriptor trd=(TriggerDescriptor)descIter.next();
    boolean triggerDroppedAlready=false;
    int[] referencedCols=trd.getReferencedCols();
    if (referencedCols != null) {
      int refColLen=referencedCols.length, j;
      boolean changed=false;
      for (j=0; j < refColLen; j++) {
        if (referencedCols[j] > droppedColumnPosition) {
          changed=true;
        }
 else         if (referencedCols[j] == droppedColumnPosition) {
          if (cascade) {
            trd.drop(lcc);
            triggerDroppedAlready=true;
            activation.addWarning(StandardException.newWarning(SQLState.LANG_TRIGGER_DROPPED,trd.getName(),td.getName()));
          }
 else {
            throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",trd.getName());
          }
          break;
        }
      }
      if (j == refColLen && changed) {
        dd.dropTriggerDescriptor(trd,tc);
        for (j=0; j < refColLen; j++) {
          if (referencedCols[j] > droppedColumnPosition)           referencedCols[j]--;
        }
        dd.addDescriptor(trd,sd,DataDictionary.SYSTRIGGERS_CATALOG_NUM,false,tc);
      }
    }
    if (triggerDroppedAlready)     continue;
    int[] referencedColsInTriggerAction=trd.getReferencedColsInTriggerAction();
    if (referencedColsInTriggerAction != null) {
      int refColInTriggerActionLen=referencedColsInTriggerAction.length, j;
      boolean changedColPositionInTriggerAction=false;
      for (j=0; j < refColInTriggerActionLen; j++) {
        if (referencedColsInTriggerAction[j] > droppedColumnPosition) {
          changedColPositionInTriggerAction=true;
        }
 else         if (referencedColsInTriggerAction[j] == droppedColumnPosition) {
          if (cascade) {
            trd.drop(lcc);
            triggerDroppedAlready=true;
            activation.addWarning(StandardException.newWarning(SQLState.LANG_TRIGGER_DROPPED,trd.getName(),td.getName()));
          }
 else {
            throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",trd.getName());
          }
          break;
        }
      }
      if (j == refColInTriggerActionLen && changedColPositionInTriggerAction) {
        dd.dropTriggerDescriptor(trd,tc);
        for (j=0; j < refColInTriggerActionLen; j++) {
          if (referencedColsInTriggerAction[j] > droppedColumnPosition)           referencedColsInTriggerAction[j]--;
        }
        trd.setReferencedColsInTriggerAction(referencedColsInTriggerAction);
        dd.addDescriptor(trd,sd,DataDictionary.SYSTRIGGERS_CATALOG_NUM,false,tc);
      }
    }
  }
  ConstraintDescriptorList csdl=dd.getConstraintDescriptors(td);
  int csdl_size=csdl.size();
  ArrayList newCongloms=new ArrayList();
  int tbr_size=0;
  ConstraintDescriptor[] toBeRemoved=new ConstraintDescriptor[csdl_size];
  for (int i=csdl_size - 1; i >= 0; i--) {
    ConstraintDescriptor cd=csdl.elementAt(i);
    int[] referencedColumns=cd.getReferencedColumns();
    int numRefCols=referencedColumns.length, j;
    boolean changed=false;
    for (j=0; j < numRefCols; j++) {
      if (referencedColumns[j] > droppedColumnPosition)       changed=true;
      if (referencedColumns[j] == droppedColumnPosition)       break;
    }
    if (j == numRefCols) {
      if ((cd instanceof CheckConstraintDescriptor) && changed) {
        dd.dropConstraintDescriptor(cd,tc);
        for (j=0; j < numRefCols; j++) {
          if (referencedColumns[j] > droppedColumnPosition)           referencedColumns[j]--;
        }
        ((CheckConstraintDescriptor)cd).setReferencedColumnsDescriptor(new ReferencedColumnsDescriptorImpl(referencedColumns));
        dd.addConstraintDescriptor(cd,tc);
      }
      continue;
    }
    if (!cascade) {
      throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",cd.getConstraintName());
    }
    if (cd instanceof ReferencedKeyConstraintDescriptor) {
      toBeRemoved[tbr_size++]=cd;
      continue;
    }
    dm.invalidateFor(cd,DependencyManager.DROP_CONSTRAINT,lcc);
    dropConstraint(cd,td,newCongloms,activation,lcc,true);
    activation.addWarning(StandardException.newWarning(SQLState.LANG_CONSTRAINT_DROPPED,cd.getConstraintName(),td.getName()));
  }
  for (int i=tbr_size - 1; i >= 0; i--) {
    ConstraintDescriptor cd=toBeRemoved[i];
    dropConstraint(cd,td,newCongloms,activation,lcc,false);
    activation.addWarning(StandardException.newWarning(SQLState.LANG_CONSTRAINT_DROPPED,cd.getConstraintName(),td.getName()));
    if (cascade) {
      ConstraintDescriptorList fkcdl=dd.getForeignKeys(cd.getUUID());
      for (int j=0; j < fkcdl.size(); j++) {
        ConstraintDescriptor fkcd=(ConstraintDescriptor)fkcdl.elementAt(j);
        dm.invalidateFor(fkcd,DependencyManager.DROP_CONSTRAINT,lcc);
        dropConstraint(fkcd,td,newCongloms,activation,lcc,true);
        activation.addWarning(StandardException.newWarning(SQLState.LANG_CONSTRAINT_DROPPED,fkcd.getConstraintName(),fkcd.getTableDescriptor().getName()));
      }
    }
    dm.invalidateFor(cd,DependencyManager.DROP_CONSTRAINT,lcc);
    dm.clearDependencies(lcc,cd);
  }
  createNewBackingCongloms(newCongloms,(long[])null);
  td=dd.getTableDescriptor(tableId);
  compressTable();
  ColumnDescriptorList tab_cdl=td.getColumnDescriptorList();
  dd.dropColumnDescriptor(td.getUUID(),columnName,tc);
  ColumnDescriptor[] cdlArray=new ColumnDescriptor[size - columnDescriptor.getPosition()];
  for (int i=columnDescriptor.getPosition(), j=0; i < size; i++, j++) {
    ColumnDescriptor cd=(ColumnDescriptor)tab_cdl.elementAt(i);
    dd.dropColumnDescriptor(td.getUUID(),cd.getColumnName(),tc);
    cd.setPosition(i);
    if (cd.isAutoincrement()) {
      cd.setAutoinc_create_or_modify_Start_Increment(ColumnDefinitionNode.CREATE_AUTOINCREMENT);
    }
    cdlArray[j]=cd;
  }
  dd.addDescriptorArray(cdlArray,td,DataDictionary.SYSCOLUMNS_CATALOG_NUM,false,tc);
  List depsOnAlterTableList=dd.getProvidersDescriptorList(td.getObjectID().toString());
  for (Iterator depsOnAlterTableIterator=depsOnAlterTableList.listIterator(); depsOnAlterTableIterator.hasNext(); ) {
    DependencyDescriptor depOnAlterTableDesc=(DependencyDescriptor)depsOnAlterTableIterator.next();
    DependableFinder dependent=depOnAlterTableDesc.getDependentFinder();
    if (dependent.getSQLObjectType().equals(Dependable.STORED_PREPARED_STATEMENT)) {
      List depsTrigger=dd.getProvidersDescriptorList(depOnAlterTableDesc.getUUID().toString());
      for (Iterator depsTriggerIterator=depsTrigger.listIterator(); depsTriggerIterator.hasNext(); ) {
        DependencyDescriptor depsTriggerDesc=(DependencyDescriptor)depsTriggerIterator.next();
        DependableFinder providerIsTrigger=depsTriggerDesc.getDependentFinder();
        if (providerIsTrigger.getSQLObjectType().equals(Dependable.TRIGGER)) {
          TriggerDescriptor trdToBeDropped=dd.getTriggerDescriptor(depsTriggerDesc.getUUID());
          columnDroppedAndTriggerDependencies(trdToBeDropped,cascade,columnName);
        }
      }
    }
  }
  dd.updateSYSCOLPERMSforDropColumn(td.getUUID(),tc,columnDescriptor);
  tab_cdl.remove(td.getColumnDescriptor(columnName));
}

Fixed version (ground truth):
/** 
 * Workhorse for dropping a column from a table. This routine drops a column from a table, taking care to properly handle the various related schema objects. The syntax which gets you here is: ALTER TABLE tbl DROP [COLUMN] col [CASCADE|RESTRICT] The keyword COLUMN is optional, and if you don't specify CASCADE or RESTRICT, the default is CASCADE (the default is chosen in the parser, not here). If you specify RESTRICT, then the column drop should be rejected if it would cause a dependent schema object to become invalid. If you specify CASCADE, then the column drop should additionally drop other schema objects which have become invalid. You may not drop the last (only) column in a table. Schema objects of interest include: - views - triggers - constraints - check constraints - primary key constraints - foreign key constraints - unique key constraints - not null constraints - privileges - indexes - default values Dropping a column may also change the column position numbers of other columns in the table, which may require fixup of schema objects (such as triggers and column privileges) which refer to columns by column position number. Indexes are a bit interesting. The official SQL spec doesn't talk about indexes; they are considered to be an imlementation-specific performance optimization. The current Derby behavior is that: - CASCADE/RESTRICT doesn't matter for indexes - when a column is dropped, it is removed from any indexes which contain it. - if that column was the only column in the index, the entire index is dropped. 
 * @param columnName the name of the column specfication in the ALTER statement-- currently we allow only one.
 * @exception StandardException 	thrown on failure.
 */
private void dropColumnFromTable(String columnName) throws StandardException {
  boolean cascade=(behavior == StatementType.DROP_CASCADE);
  ColumnDescriptorList generatedColumnList=td.getGeneratedColumns();
  int generatedColumnCount=generatedColumnList.size();
  ArrayList cascadedDroppedColumns=new ArrayList();
  for (int i=0; i < generatedColumnCount; i++) {
    ColumnDescriptor generatedColumn=generatedColumnList.elementAt(i);
    String[] referencedColumnNames=generatedColumn.getDefaultInfo().getReferencedColumnNames();
    int referencedColumnCount=referencedColumnNames.length;
    for (int j=0; j < referencedColumnCount; j++) {
      if (columnName.equals(referencedColumnNames[j])) {
        String generatedColumnName=generatedColumn.getColumnName();
        if (!cascade) {
          throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",generatedColumnName);
        }
 else {
          cascadedDroppedColumns.add(generatedColumnName);
        }
      }
    }
  }
  DataDescriptorGenerator ddg=dd.getDataDescriptorGenerator();
  int cascadedDrops=cascadedDroppedColumns.size();
  int sizeAfterCascadedDrops=td.getColumnDescriptorList().size() - cascadedDrops;
  if (sizeAfterCascadedDrops == 1) {
    throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),"String_Node_Str" + columnName,"String_Node_Str",td.getQualifiedName());
  }
  for (int i=0; i < cascadedDrops; i++) {
    String generatedColumnName=(String)cascadedDroppedColumns.get(i);
    activation.addWarning(StandardException.newWarning(SQLState.LANG_GEN_COL_DROPPED,generatedColumnName,td.getName()));
    dropColumnFromTable(generatedColumnName);
  }
  td=dd.getTableDescriptor(tableId);
  ColumnDescriptor columnDescriptor=td.getColumnDescriptor(columnName);
  if (columnDescriptor == null) {
    throw StandardException.newException(SQLState.LANG_COLUMN_NOT_FOUND_IN_TABLE,columnName,td.getQualifiedName());
  }
  int size=td.getColumnDescriptorList().size();
  droppedColumnPosition=columnDescriptor.getPosition();
  FormatableBitSet toDrop=new FormatableBitSet(size + 1);
  toDrop.set(droppedColumnPosition);
  td.setReferencedColumnMap(toDrop);
  dm.invalidateFor(td,(cascade ? DependencyManager.DROP_COLUMN : DependencyManager.DROP_COLUMN_RESTRICT),lcc);
  if (columnDescriptor.getDefaultInfo() != null) {
    dm.clearDependencies(lcc,columnDescriptor.getDefaultDescriptor(dd));
  }
  GenericDescriptorList tdl=dd.getTriggerDescriptors(td);
  for (Iterator descIter=tdl.iterator(); descIter.hasNext(); ) {
    TriggerDescriptor trd=(TriggerDescriptor)descIter.next();
    boolean triggerDroppedAlready=false;
    int[] referencedCols=trd.getReferencedCols();
    if (referencedCols != null) {
      int refColLen=referencedCols.length, j;
      boolean changed=false;
      for (j=0; j < refColLen; j++) {
        if (referencedCols[j] > droppedColumnPosition) {
          changed=true;
        }
 else         if (referencedCols[j] == droppedColumnPosition) {
          if (cascade) {
            trd.drop(lcc);
            triggerDroppedAlready=true;
            activation.addWarning(StandardException.newWarning(SQLState.LANG_TRIGGER_DROPPED,trd.getName(),td.getName()));
          }
 else {
            throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",trd.getName());
          }
          break;
        }
      }
      if (j == refColLen && changed) {
        dd.dropTriggerDescriptor(trd,tc);
        for (j=0; j < refColLen; j++) {
          if (referencedCols[j] > droppedColumnPosition)           referencedCols[j]--;
        }
        trd.setReferencedCols(referencedCols);
        dd.addDescriptor(trd,sd,DataDictionary.SYSTRIGGERS_CATALOG_NUM,false,tc);
      }
    }
    if (triggerDroppedAlready)     continue;
    int[] referencedColsInTriggerAction=trd.getReferencedColsInTriggerAction();
    if (referencedColsInTriggerAction != null) {
      int refColInTriggerActionLen=referencedColsInTriggerAction.length, j;
      boolean changedColPositionInTriggerAction=false;
      for (j=0; j < refColInTriggerActionLen; j++) {
        if (referencedColsInTriggerAction[j] > droppedColumnPosition) {
          changedColPositionInTriggerAction=true;
        }
 else         if (referencedColsInTriggerAction[j] == droppedColumnPosition) {
          if (cascade) {
            trd.drop(lcc);
            triggerDroppedAlready=true;
            activation.addWarning(StandardException.newWarning(SQLState.LANG_TRIGGER_DROPPED,trd.getName(),td.getName()));
          }
 else {
            throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",trd.getName());
          }
          break;
        }
      }
      if (j == refColInTriggerActionLen && changedColPositionInTriggerAction) {
        dd.dropTriggerDescriptor(trd,tc);
        for (j=0; j < refColInTriggerActionLen; j++) {
          if (referencedColsInTriggerAction[j] > droppedColumnPosition)           referencedColsInTriggerAction[j]--;
        }
        trd.setReferencedColsInTriggerAction(referencedColsInTriggerAction);
        dd.addDescriptor(trd,sd,DataDictionary.SYSTRIGGERS_CATALOG_NUM,false,tc);
      }
    }
  }
  ConstraintDescriptorList csdl=dd.getConstraintDescriptors(td);
  int csdl_size=csdl.size();
  ArrayList newCongloms=new ArrayList();
  int tbr_size=0;
  ConstraintDescriptor[] toBeRemoved=new ConstraintDescriptor[csdl_size];
  for (int i=csdl_size - 1; i >= 0; i--) {
    ConstraintDescriptor cd=csdl.elementAt(i);
    int[] referencedColumns=cd.getReferencedColumns();
    int numRefCols=referencedColumns.length, j;
    boolean changed=false;
    for (j=0; j < numRefCols; j++) {
      if (referencedColumns[j] > droppedColumnPosition)       changed=true;
      if (referencedColumns[j] == droppedColumnPosition)       break;
    }
    if (j == numRefCols) {
      if ((cd instanceof CheckConstraintDescriptor) && changed) {
        dd.dropConstraintDescriptor(cd,tc);
        for (j=0; j < numRefCols; j++) {
          if (referencedColumns[j] > droppedColumnPosition)           referencedColumns[j]--;
        }
        ((CheckConstraintDescriptor)cd).setReferencedColumnsDescriptor(new ReferencedColumnsDescriptorImpl(referencedColumns));
        dd.addConstraintDescriptor(cd,tc);
      }
      continue;
    }
    if (!cascade) {
      throw StandardException.newException(SQLState.LANG_PROVIDER_HAS_DEPENDENT_OBJECT,dm.getActionString(DependencyManager.DROP_COLUMN),columnName,"String_Node_Str",cd.getConstraintName());
    }
    if (cd instanceof ReferencedKeyConstraintDescriptor) {
      toBeRemoved[tbr_size++]=cd;
      continue;
    }
    dm.invalidateFor(cd,DependencyManager.DROP_CONSTRAINT,lcc);
    dropConstraint(cd,td,newCongloms,activation,lcc,true);
    activation.addWarning(StandardException.newWarning(SQLState.LANG_CONSTRAINT_DROPPED,cd.getConstraintName(),td.getName()));
  }
  for (int i=tbr_size - 1; i >= 0; i--) {
    ConstraintDescriptor cd=toBeRemoved[i];
    dropConstraint(cd,td,newCongloms,activation,lcc,false);
    activation.addWarning(StandardException.newWarning(SQLState.LANG_CONSTRAINT_DROPPED,cd.getConstraintName(),td.getName()));
    if (cascade) {
      ConstraintDescriptorList fkcdl=dd.getForeignKeys(cd.getUUID());
      for (int j=0; j < fkcdl.size(); j++) {
        ConstraintDescriptor fkcd=(ConstraintDescriptor)fkcdl.elementAt(j);
        dm.invalidateFor(fkcd,DependencyManager.DROP_CONSTRAINT,lcc);
        dropConstraint(fkcd,td,newCongloms,activation,lcc,true);
        activation.addWarning(StandardException.newWarning(SQLState.LANG_CONSTRAINT_DROPPED,fkcd.getConstraintName(),fkcd.getTableDescriptor().getName()));
      }
    }
    dm.invalidateFor(cd,DependencyManager.DROP_CONSTRAINT,lcc);
    dm.clearDependencies(lcc,cd);
  }
  createNewBackingCongloms(newCongloms,(long[])null);
  td=dd.getTableDescriptor(tableId);
  compressTable();
  ColumnDescriptorList tab_cdl=td.getColumnDescriptorList();
  dd.dropColumnDescriptor(td.getUUID(),columnName,tc);
  ColumnDescriptor[] cdlArray=new ColumnDescriptor[size - columnDescriptor.getPosition()];
  for (int i=columnDescriptor.getPosition(), j=0; i < size; i++, j++) {
    ColumnDescriptor cd=(ColumnDescriptor)tab_cdl.elementAt(i);
    dd.dropColumnDescriptor(td.getUUID(),cd.getColumnName(),tc);
    cd.setPosition(i);
    if (cd.isAutoincrement()) {
      cd.setAutoinc_create_or_modify_Start_Increment(ColumnDefinitionNode.CREATE_AUTOINCREMENT);
    }
    cdlArray[j]=cd;
  }
  dd.addDescriptorArray(cdlArray,td,DataDictionary.SYSCOLUMNS_CATALOG_NUM,false,tc);
  List depsOnAlterTableList=dd.getProvidersDescriptorList(td.getObjectID().toString());
  for (Iterator depsOnAlterTableIterator=depsOnAlterTableList.listIterator(); depsOnAlterTableIterator.hasNext(); ) {
    DependencyDescriptor depOnAlterTableDesc=(DependencyDescriptor)depsOnAlterTableIterator.next();
    DependableFinder dependent=depOnAlterTableDesc.getDependentFinder();
    if (dependent.getSQLObjectType().equals(Dependable.STORED_PREPARED_STATEMENT)) {
      List depsTrigger=dd.getProvidersDescriptorList(depOnAlterTableDesc.getUUID().toString());
      for (Iterator depsTriggerIterator=depsTrigger.listIterator(); depsTriggerIterator.hasNext(); ) {
        DependencyDescriptor depsTriggerDesc=(DependencyDescriptor)depsTriggerIterator.next();
        DependableFinder providerIsTrigger=depsTriggerDesc.getDependentFinder();
        if (providerIsTrigger.getSQLObjectType().equals(Dependable.TRIGGER)) {
          TriggerDescriptor trdToBeDropped=dd.getTriggerDescriptor(depsTriggerDesc.getUUID());
          columnDroppedAndTriggerDependencies(trdToBeDropped,cascade,columnName);
        }
      }
    }
  }
  dd.updateSYSCOLPERMSforDropColumn(td.getUUID(),tc,columnDescriptor);
  tab_cdl.remove(td.getColumnDescriptor(columnName));
}