Class ModifyColumnNode

All Implemented Interfaces:
Visitable

class ModifyColumnNode extends ColumnDefinitionNode
A ModifyColumnNode represents a modify column in an ALTER TABLE statement.
  • Field Details

  • Constructor Details

  • Method Details

    • getOldDefaultUUID

      UUID getOldDefaultUUID()
      Get the UUID of the old column default.
      Overrides:
      getOldDefaultUUID in class ColumnDefinitionNode
      Returns:
      The UUID of the old column default.
    • getColumnPosition

      int getColumnPosition()
      Get the column position for the column.
      Returns:
      The column position for the column.
    • checkUserType

      void checkUserType(TableDescriptor td) throws StandardException
      Check the validity of a user type. Checks that 1. the column type is either varchar, .... 2. is the same type after the alter. 3. length is greater than the old length.
      Overrides:
      checkUserType in class ColumnDefinitionNode
      Throws:
      StandardException - Thrown on error
    • checkExistingConstraints

      void checkExistingConstraints(TableDescriptor td) throws StandardException
      Check if the the column can be modified, and throw error if not. If the type of a column is being changed (for instance if the length of the column is being increased) then make sure that this does not violate any key constraints; the column being altered is 1. part of foreign key constraint ==> ERROR. This references a Primary Key constraint and the type and lengths of the pkey/fkey must match exactly. 2. part of a unique/primary key constraint ==> OK if no fkey references this constraint. ==> ERROR if any fkey in the system references this constraint.
      Parameters:
      td - The Table Descriptor on which the ALTER is being done.
      Throws:
      StandardException - Thrown on Error.
    • useExistingCollation

      void useExistingCollation(TableDescriptor td) throws StandardException
      If the column being modified is of character string type, then it should get its collation from the corresponding column in the TableDescriptor. This will ensure that at alter table time, the existing character string type columns do not loose their collation type. If the alter table is doing a drop column, then we do not need to worry about collation info.
      Parameters:
      td - Table Descriptor that holds the column which is being altered
      Throws:
      StandardException
    • getAction

      int getAction()
      Get the action associated with this node.
      Overrides:
      getAction in class ColumnDefinitionNode
      Returns:
      The action associated with this node.
    • bindAndValidateDefault

      void bindAndValidateDefault(DataDictionary dd, TableDescriptor td) throws StandardException
      Check the validity of the default, if any, for this node.
      Overrides:
      bindAndValidateDefault in class ColumnDefinitionNode
      Parameters:
      dd - The DataDictionary.
      td - The TableDescriptor.
      Throws:
      StandardException - Thrown on error
    • getLocalColumnDescriptor

      private ColumnDescriptor getLocalColumnDescriptor(String name, TableDescriptor td) throws StandardException
      Throws:
      StandardException
    • validateAutoincrement

      void validateAutoincrement(DataDictionary dd, TableDescriptor td, int tableType) throws StandardException
      check the validity of autoincrement values in the case that we are modifying an existing column (includes checking if autoincrement is set when making a column nullable)
      Overrides:
      validateAutoincrement in class ColumnDefinitionNode
      Parameters:
      dd - DataDictionary.
      td - table descriptor.
      tableType - base table or declared global temporary table.
      Throws:
      StandardException - if autoincrement default is incorrect; i.e if increment is 0 or if initial or increment values are out of range for the datatype.