Class PgAbstractView
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatementContainer
org.pgcodekeeper.core.database.pg.schema.PgAbstractView
- All Implemented Interfaces:
IOptionContainer,IRelation,ISearchPath,ISimpleOptionContainer,IStatement,IStatementContainer,IView,IHashable
- Direct Known Subclasses:
PgMaterializedView,PgView
public abstract class PgAbstractView
extends PgAbstractStatementContainer
implements IView, 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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumnComment(String columnName, String comment) Adds a comment to a view column.voidaddColumnName(String colName) Adds a column name to this view.voidAdds an option to this container.voidappendAlterComments(AbstractStatement newObj, SQLScript script) Appends ALTER comment SQL if the comment has changed.appendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typevoidappendComments(SQLScript script) Appends comment SQL to the script if this statement has comments.booleanChecks if this statement can be dropped before being recreated.booleancompare(IStatement obj) This method does not account for nested child PgStatements.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.Gets all options for this container.Gets the columns of this relation as name-type pairs.voidSets the view query and its normalized form.Methods inherited from class org.pgcodekeeper.core.database.pg.schema.PgAbstractStatementContainer
addChild, compareChildren, computeChildrenHash, fillChildrenList, getChild, getChildrenByType, getIndex, getIndexes, getPolicies, getPolicy, getRule, getTrigger, getTriggers, isClusteredMethods inherited from class org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
addPrivilege, appendDefaultPrivileges, appendOwnerSQL, formatSql, getQuoter, getRenameCommand, isOwnedMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, appendPrivileges, canDrop, checkComments, clearPrivileges, deepCopy, equals, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSeparator, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getContainingSchema, getDatabase, getSchemaName, toObjectReferenceMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISimpleOptionContainer
appendOptions, compareOptionsMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatementContainer
addChild, getChild, getChildrenByTypeMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IView
getStatementType
-
Field Details
-
CHECK_OPTION
- See Also:
-
-
Method Details
-
getCreationSQL
Description copied from interface:IStatementGenerates 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:
getCreationSQLin interfaceIStatement- Parameters:
script- the SQL script to append creation statements to
-
appendComments
Description copied from class:AbstractStatementAppends comment SQL to the script if this statement has comments.- Overrides:
appendCommentsin classAbstractStatement- Parameters:
script- the SQL script to append comments to
-
appendAlterSQL
Description copied from interface:IStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin interfaceIStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
appendAlterComments
Description copied from class:AbstractStatementAppends ALTER comment SQL if the comment has changed.- Overrides:
appendAlterCommentsin classAbstractStatement- Parameters:
newObj- the new statement to compare comments withscript- the SQL script to append ALTER comments to
-
canDropBeforeCreate
public boolean canDropBeforeCreate()Description copied from interface:IStatementChecks if this statement can be dropped before being recreated. Override in subclasses that support drop-before-create behavior.- Specified by:
canDropBeforeCreatein interfaceIStatement- Overrides:
canDropBeforeCreatein classAbstractStatement- Returns:
- true if the statement can be dropped before recreation
-
addColumnName
Adds a column name to this view.- Parameters:
colName- column name to add
-
setQuery
Sets the view query and its normalized form.- Parameters:
query- original query textnormalizedQuery- normalized query for comparison
-
getOptions
Description copied from interface:IOptionContainerGets all options for this container.- Specified by:
getOptionsin interfaceIOptionContainer- Returns:
- a map of option keys to values
-
addOption
Description copied from interface:IOptionContainerAdds an option to this container.- Specified by:
addOptionin interfaceIOptionContainer- Parameters:
option- the option keyvalue- the option value
-
addColumnComment
Adds a comment to a view column.- Parameters:
columnName- column namecomment- comment text (ignored if null or empty)
-
getRelationColumns
Description copied from interface:IRelationGets the columns of this relation as name-type pairs.- Specified by:
getRelationColumnsin interfaceIRelation- Returns:
- a stream of column name and type pairs
-
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Parameters:
hasher- the hasher instance to use for hash computation
-
getConstraints
- Specified by:
getConstraintsin classPgAbstractStatementContainer
-
compare
Description copied from class:AbstractStatementThis method does not account for nested child PgStatements. Shallow version ofAbstractStatement.equals(Object)- Specified by:
comparein interfaceIStatement- Overrides:
comparein classAbstractStatement
-