Class PgIndex
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgIndex
- All Implemented Interfaces:
IIndex,IOptionContainer,ISearchPath,ISimpleColumnContainer,ISimpleOptionContainer,IStatement,ISubElement,IHashable
PostgreSQL index implementation.
Supports all PostgreSQL index features including unique constraints,
partial indexes, expression indexes, and index inheritance for partitioned tables.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(SimpleColumn column) Adds a column reference to this container.voidaddInclude(String column) Adds an included column to this container.voidaddInherit(String schemaName, String indexName) Sets the parent index for this partitioned index.voidAdds an option to this container.appendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleancanDrop()booleancompare(IStatement obj) This method does not account for nested child PgStatements.booleancompareColumns(Collection<String> refs) Compares the columns of this index with a collection of column references.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 the index access method (btree, hash, gin, gist, etc.).Gets all options for this container.Gets the fully qualified name of this statement.booleanbooleanisUnique()voidsetClustered(boolean isClustered) voidvoidsetNullsDistinction(boolean nullsDistinction) voidsetTablespace(String tablespace) voidsetUnique(boolean isUnique) voidMethods 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, appendAlterComments, appendComments, appendPrivileges, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getSeparator, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IIndex
getStatementType, toObjectReferenceMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISimpleOptionContainer
appendOptions, compareOptionsMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, 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.ISubElement
getContainingSchema
-
Constructor Details
-
PgIndex
Creates a new PostgreSQL index.- Parameters:
name- index name
-
-
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
-
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
-
getQualifiedName
Description copied from interface:IStatementGets the fully qualified name of this statement.- Specified by:
getQualifiedNamein interfaceIStatement- Overrides:
getQualifiedNamein classAbstractStatement- Returns:
- fully qualified (up to schema) dot-delimited object name. Identifiers are quoted.
-
canDrop
public boolean canDrop()- Specified by:
canDropin interfaceIStatement- Overrides:
canDropin classAbstractStatement- Returns:
- true if the statement can be dropped
-
compareColumns
Description copied from interface:IIndexCompares the columns of this index with a collection of column references.- Specified by:
compareColumnsin interfaceIIndex- Parameters:
refs- the collection of column references to compare against- Returns:
- true if the columns match in order and count
-
getMethod
Gets the index access method (btree, hash, gin, gist, etc.).- Returns:
- index method name
-
setMethod
-
addInherit
Sets the parent index for this partitioned index.- Parameters:
schemaName- parent index schema nameindexName- parent index name
-
setNullsDistinction
public void setNullsDistinction(boolean nullsDistinction) -
addOption
Description copied from interface:IOptionContainerAdds an option to this container.- Specified by:
addOptionin interfaceIOptionContainer- Parameters:
key- the option keyvalue- the option value
-
getOptions
Description copied from interface:IOptionContainerGets all options for this container.- Specified by:
getOptionsin interfaceIOptionContainer- Returns:
- a map of option keys to values
-
addColumn
Description copied from interface:ISimpleColumnContainerAdds a column reference to this container.- Specified by:
addColumnin interfaceISimpleColumnContainer- Parameters:
column- the simple column to add
-
addInclude
Description copied from interface:ISimpleColumnContainerAdds an included column to this container.- Specified by:
addIncludein interfaceISimpleColumnContainer- Parameters:
column- the column name to include
-
isClustered
public boolean isClustered() -
setClustered
public void setClustered(boolean isClustered) -
setUnique
public void setUnique(boolean isUnique) -
setWhere
-
setTablespace
-
isUnique
public boolean isUnique() -
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
-
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
-