Class PgColumn

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

public final class PgColumn extends AbstractColumn implements ISimpleOptionContainer, ICompressOptionContainer
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()
      Description copied from class: AbstractColumn
      Returns the complete column definition including type, constraints, and other attributes.
      Specified by:
      getFullDefinition in class AbstractColumn
      Returns:
      the full column definition as SQL string
    • getCreationSQL

      public void getCreationSQL(SQLScript script)
      Description copied from class: PgStatement
      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 class PgStatement
      Parameters:
      script - the SQL script to append creation statements to
    • getDropSQL

      public void getDropSQL(SQLScript script, boolean optionExists)
      Description copied from class: PgStatement
      Generates DROP SQL for this statement.
      Overrides:
      getDropSQL in class PgStatement
      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(PgStatement newCondition, SQLScript script)
      Description copied from class: PgStatement
      Fill script with object changes and return change type
      Specified by:
      appendAlterSQL in class PgStatement
      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 AbstractColumn getParentCol(AbstractPgTable 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)
    • isGenerated

      public boolean isGenerated()
    • setGenerated

      public void setGenerated(boolean isGenerated)
    • 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)
    • compare

      public boolean compare(PgStatement obj)
      Description copied from class: PgStatement
      This method does not account for nested child PgStatements. Shallow version of PgStatement.equals(Object)
      Overrides:
      compare in class AbstractColumn
    • 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
      Overrides:
      computeHash in class AbstractColumn
      Parameters:
      hasher - the hasher instance to use for hash computation