Class PgConstraintFk

All Implemented Interfaces:
IConstraint, IConstraintFk, ISearchPath, IStatement, ISubElement, IHashable

public class PgConstraintFk extends PgConstraint implements IConstraintFk
PostgreSQL FOREIGN KEY constraint implementation. Foreign key constraints maintain referential integrity between tables by ensuring values in one table match values in a referenced table.
  • Constructor Details

    • PgConstraintFk

      public PgConstraintFk(String name)
      Creates a new PostgreSQL FOREIGN KEY constraint.
      Parameters:
      name - constraint name
  • Method Details

    • getDefinition

      public String getDefinition()
      Description copied from interface: IConstraint
      Gets the SQL definition of this constraint.
      Specified by:
      getDefinition in interface IConstraint
      Returns:
      the constraint definition
    • getErrorCode

      public String getErrorCode()
    • getColumns

      public List<String> getColumns()
      Description copied from interface: IConstraint
      Gets the columns involved in this constraint.
      Specified by:
      getColumns in interface IConstraint
      Overrides:
      getColumns in class PgConstraint
      Returns:
      a collection of column names
    • addColumn

      public void addColumn(String column)
      Adds a column to this foreign key constraint.
      Parameters:
      column - column name
    • addDelActCol

      public void addDelActCol(String col)
    • getForeignColumns

      public List<String> getForeignColumns()
      Description copied from interface: IConstraintFk
      Gets the foreign columns referenced by this foreign key.
      Specified by:
      getForeignColumns in interface IConstraintFk
      Returns:
      a collection of foreign column names
    • addForeignColumn

      public void addForeignColumn(String referencedColumn)
      Adds a referenced column in the foreign table.
      Parameters:
      referencedColumn - referenced column name
    • getForeignSchema

      public String getForeignSchema()
      Description copied from interface: IConstraintFk
      Gets the foreign schema containing the referenced table.
      Specified by:
      getForeignSchema in interface IConstraintFk
      Returns:
      the foreign schema name
    • setForeignSchema

      public void setForeignSchema(String foreignSchema)
    • getForeignTable

      public String getForeignTable()
      Description copied from interface: IConstraintFk
      Gets the foreign table referenced by this foreign key.
      Specified by:
      getForeignTable in interface IConstraintFk
      Returns:
      the foreign table name
    • setForeignTable

      public void setForeignTable(String foreignTable)
    • setMatch

      public void setMatch(String match)
    • setDelAction

      public void setDelAction(String delAction)
    • setUpdAction

      public void setUpdAction(String updAction)
    • setPeriodRefColumn

      public void setPeriodRefColumn(String periodRefColumn)
    • setPeriodColumn

      public void setPeriodColumn(String periodColumn)
    • 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 PgConstraint
      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 PgConstraint