Class AbstractPgTable

All Implemented Interfaces:
IHashable, IOptionContainer, IRelation, ISearchPath, IStatement, IStatementContainer
Direct Known Subclasses:
AbstractForeignTable, AbstractRegularTable, GpExternalTable

public abstract class AbstractPgTable extends AbstractTable
Base PostgreSQL table class providing common functionality for all PostgreSQL table types. Handles table inheritance, trigger states, column management, and various PostgreSQL-specific table features like WITH OIDS, row-level security, and storage parameters.
Since:
5.3.1.
Author:
galiev_mr
  • Method Details

    • 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
    • appendComments

      public void appendComments(SQLScript script)
      Description copied from class: PgStatement
      Appends comment SQL to the script if this statement has comments.
      Overrides:
      appendComments in class PgStatement
      Parameters:
      script - the SQL script to append comments to
    • 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
    • getRelationColumns

      public Stream<Pair<String,String>> getRelationColumns()
      Description copied from interface: IRelation
      Gets the columns of this relation as name-type pairs.
      Specified by:
      getRelationColumns in interface IRelation
      Overrides:
      getRelationColumns in class AbstractTable
      Returns:
      a stream of column name and type pairs
    • addInherits

      public void addInherits(String schemaName, String tableName)
      Adds a parent table to the inheritance list.
      Parameters:
      schemaName - parent table schema name.
      tableName - parent table name
    • getInherits

      public List<Inherits> getInherits()
      Getter for inherits.
      Returns:
      inherits
    • hasInherits

      public boolean hasInherits()
      Checks if this table has any inheritance relationships.
      Returns:
      true if table inherits from other tables
    • putTriggerState

      public void putTriggerState(String triggerName, TriggerState state)
      Sets the state of a specific trigger on this table.
      Parameters:
      triggerName - name of the trigger
      state - desired trigger state
    • setHasOids

      public void setHasOids(boolean hasOids)
    • sortColumns

      public void sortColumns()
      Sorts columns on table.

      First the usual columns in the order of adding, then sorted alphabetically the inheritance columns
    • 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 AbstractTable
    • 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 AbstractTable
      Parameters:
      hasher - the hasher instance to use for hash computation
    • shallowCopy

      public AbstractTable shallowCopy()
      Description copied from class: PgStatement
      Copies all object properties into a new object and leaves all its children empty.
      Overrides:
      shallowCopy in class AbstractTable
      Returns:
      shallow copy of a DB object.
    • getColsForMovingData

      public List<String> getColsForMovingData(AbstractTable newTable)