Class ModifyColumnNode

  • All Implemented Interfaces:
    Visitable

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

      • getColumnPosition

        int getColumnPosition()
        Get the column position for the column.
        Returns:
        The column position for the column.
      • 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.
      • 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.