Class PgConstraintNotNull
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
org.pgcodekeeper.core.database.pg.schema.PgConstraint
org.pgcodekeeper.core.database.pg.schema.PgConstraintNotNull
- All Implemented Interfaces:
IConstraint,ISearchPath,IStatement,ISubElement,IHashable
PostgreSQL NOT NULL constraint implementation.
NOT NULL constraints ensure that a column cannot contain NULL values.
Since PostgreSQL 18, NOT NULL constraints can be named and support NO INHERIT option.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPgConstraintNotNull(String name) PgConstraintNotNull(String tableName, String columnName) -
Method Summary
Modifier and TypeMethodDescriptionbooleancompare(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.Gets the SQL definition of this constraint.voidgetRenameCommand(String newName) Returns sql command to rename the given object.Gets the name of the table this constraint belongs to.booleanvoidsetNoInherit(boolean noInherit) Methods inherited from class org.pgcodekeeper.core.database.pg.schema.PgConstraint
appendAlterSQL, appendOptions, containsColumn, getColumns, getCreationSQL, getDropSQL, isNotValid, setDeferrable, setInitially, setNotEnforced, setNotValidMethods inherited from class org.pgcodekeeper.core.database.pg.schema.PgAbstractStatement
addPrivilege, appendDefaultPrivileges, appendOwnerSQL, formatSql, getQuoter, isOwnedMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, appendAlterComments, appendComments, appendPrivileges, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, 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.IConstraint
getStatementType, isPrimaryKeyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISubElement
getContainingSchema, toObjectReference
-
Field Details
-
NO_INHERIT
- See Also:
-
-
Constructor Details
-
PgConstraintNotNull
-
PgConstraintNotNull
-
-
Method Details
-
getDefinition
Description copied from interface:IConstraintGets the SQL definition of this constraint.- Returns:
- the constraint definition
-
getDefinitionForColumn
-
getRenameCommand
Description copied from interface:IStatementReturns sql command to rename the given object.- Specified by:
getRenameCommandin interfaceIStatement- Overrides:
getRenameCommandin classPgAbstractStatement- Parameters:
newName- the new name for given object- Returns:
- sql command to rename the given object
-
getErrorCode
-
setNoInherit
public void setNoInherit(boolean noInherit) -
getTableName
Description copied from interface:IConstraintGets the name of the table this constraint belongs to.- Specified by:
getTableNamein interfaceIConstraint- Overrides:
getTableNamein classPgConstraint- Returns:
- the table name
-
isComplexNotNull
public boolean isComplexNotNull()- Returns:
- true if the constraint can only be written via ALTER TABLE
-
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- Overrides:
computeHashin classPgConstraint- 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 classPgConstraint
-