All Implemented Interfaces:
IColumn, IOptionContainer, ISearchPath, ISimpleOptionContainer, IStatement, ISubElement, ICompressOptionContainer, IHashable

PostgreSQL column implementation. Stores column information including data type, constraints, storage parameters, statistics, compression settings, and identity properties.
  • Constructor Details

    • PgColumn

      public PgColumn(String name)
      Creates a new PostgreSQL column.
      Parameters:
      name - column name
  • Method Details

    • getFullDefinition

      public String getFullDefinition()
    • getCreationSQL

      public void getCreationSQL(SQLScript script)
      Description copied from interface: IStatement
      Generates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.
      Specified by:
      getCreationSQL in interface IStatement
      Parameters:
      script - the SQL script to append creation statements to
    • getDropSQL

      public void getDropSQL(SQLScript script, boolean optionExists)
      Description copied from interface: IStatement
      Generates DROP SQL for this statement.
      Specified by:
      getDropSQL in interface IStatement
      Overrides:
      getDropSQL in class AbstractStatement
      Parameters:
      script - the SQL script to append the DROP statement to
      optionExists - whether to include "IF EXISTS" in the DROP statement
    • appendAlterSQL

      public ObjectState appendAlterSQL(IStatement newCondition, SQLScript script)
      Description copied from interface: IStatement
      Fill script with object changes and return change type
      Specified by:
      appendAlterSQL in interface IStatement
      Parameters:
      newCondition - new object state
      script - script to collect changes
      Returns:
      object change type
    • isJoinable

      public boolean isJoinable(PgColumn newColumn)
      Checks if this column can be joined with another column in a single ALTER statement.
      Parameters:
      newColumn - column to compare with
      Returns:
      true if columns can be joined in one ALTER statement
    • joinAction

      public void joinAction(StringBuilder sb, PgColumn newColumn, boolean isNeedAlterTable, boolean isLastColumn, ISettings settings)
      Generates SQL for joining column changes in a single ALTER statement.
      Parameters:
      sb - StringBuilder to append SQL to
      newColumn - new column state
      isNeedAlterTable - whether to include ALTER TABLE prefix
      isLastColumn - whether this is the last column in a multi-column ALTER
      settings - generation settings
    • getParentCol

      public PgColumn getParentCol(PgAbstractTable tbl)
      Returns the parent column for given column or null if given column hasn't parent column.
      Parameters:
      tbl - table to search inheritance hierarchy from
      Returns:
      parent column or null if no parent column exists
    • getOptions

      public Map<String,String> getOptions()
      Description copied from interface: IOptionContainer
      Gets all options for this container.
      Specified by:
      getOptions in interface IOptionContainer
      Returns:
      a map of option keys to values
    • addOption

      public void addOption(String attribute, String value)
      Description copied from interface: IOptionContainer
      Adds an option to this container.
      Specified by:
      addOption in interface IOptionContainer
      Parameters:
      attribute - the option key
      value - the option value
    • getForeignOptions

      public Map<String,String> getForeignOptions()
    • addForeignOption

      public void addForeignOption(String attribute, String value)
      Adds a foreign table option to this column.
      Parameters:
      attribute - option name
      value - option value
    • setCompressType

      public void setCompressType(String compressType)
      Description copied from interface: ICompressOptionContainer
      Sets the compression type for this object.
      Specified by:
      setCompressType in interface ICompressOptionContainer
      Parameters:
      compressType - the compression type to set
    • setCompressLevel

      public void setCompressLevel(int compressLevel)
      Description copied from interface: ICompressOptionContainer
      Sets the compression level for this object.
      Specified by:
      setCompressLevel in interface ICompressOptionContainer
      Parameters:
      compressLevel - the compression level to set
    • setBlockSize

      public void setBlockSize(int blockSize)
      Description copied from interface: ICompressOptionContainer
      Sets the block size for this object.
      Specified by:
      setBlockSize in interface ICompressOptionContainer
      Parameters:
      blockSize - the block size to set
    • isInherit

      public boolean isInherit()
    • setInherit

      public void setInherit(boolean isInherit)
    • isNotNull

      public boolean isNotNull()
      Specified by:
      isNotNull in interface IColumn
    • isGenerated

      public boolean isGenerated()
    • setGenerationOption

      public void setGenerationOption(String generationOption)
    • setStatistics

      public void setStatistics(Integer statistics)
    • getStatistics

      public Integer getStatistics()
    • getStorage

      public String getStorage()
    • setStorage

      public void setStorage(String storage)
    • getSequence

      public PgSequence getSequence()
    • setSequence

      public void setSequence(PgSequence sequence)
    • setIdentityType

      public void setIdentityType(String identityType)
    • getIdentityType

      public String getIdentityType()
    • setCompression

      public void setCompression(String compression)
    • getNotNullConstraint

      public PgConstraintNotNull getNotNullConstraint()
    • setNotNullConstraint

      public void setNotNullConstraint(PgConstraintNotNull notNullConstraint)
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
    • getDefaultValue

      public String getDefaultValue()
    • setType

      public void setType(String type)
    • getType

      public String getType()
      Specified by:
      getType in interface IColumn
    • setCollation

      public void setCollation(String collation)
    • getCollation

      public String getCollation()
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(IStatement obj)
      Description copied from class: AbstractStatement
      This method does not account for nested child PgStatements. Shallow version of AbstractStatement.equals(Object)
      Specified by:
      compare in interface IStatement
      Overrides:
      compare in class AbstractStatement