Class AbstractPgView

All Implemented Interfaces:
IHashable, IOptionContainer, IRelation, ISearchPath, ISimpleOptionContainer, IStatement, IStatementContainer
Direct Known Subclasses:
MaterializedPgView, PgView

public abstract class AbstractPgView extends AbstractView implements ISimpleOptionContainer
Base PostgreSQL view implementation. Provides common functionality for PostgreSQL views including query handling, column comments, view options, and default values management.
Author:
fordfrog
  • Field Details

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

      public void appendAlterComments(PgStatement newObj, SQLScript script)
      Description copied from class: PgStatement
      Appends ALTER comment SQL if the comment has changed.
      Overrides:
      appendAlterComments in class PgStatement
      Parameters:
      newObj - the new statement to compare comments with
      script - the SQL script to append ALTER comments to
    • canDropBeforeCreate

      public boolean canDropBeforeCreate()
      Description copied from class: PgStatement
      Checks if this statement can be dropped before being recreated. Override in subclasses that support drop-before-create behavior.
      Overrides:
      canDropBeforeCreate in class PgStatement
      Returns:
      true if the statement can be dropped before recreation
    • addColumnName

      public void addColumnName(String colName)
      Adds a column name to this view.
      Parameters:
      colName - column name to add
    • setQuery

      public void setQuery(String query, String normalizedQuery)
      Sets the view query and its normalized form.
      Parameters:
      query - original query text
      normalizedQuery - normalized query for comparison
    • 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 option, String value)
      Description copied from interface: IOptionContainer
      Adds an option to this container.
      Specified by:
      addOption in interface IOptionContainer
      Parameters:
      option - the option key
      value - the option value
    • addColumnComment

      public void addColumnComment(String columnName, String comment)
      Adds a comment to a view column.
      Parameters:
      columnName - column name
      comment - comment text (ignored if null or empty)
    • 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 AbstractView
      Returns:
      a stream of column name and type pairs
    • 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 AbstractView
    • 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