Package dev.frostlake.metastore.model
Class CheckConstraint
java.lang.Object
dev.frostlake.metastore.model.CheckConstraint
A CHECK constraint: a boolean expression every written row must not make FALSE. Unlike the primary,
unique and foreign keys — which Snowflake records but does not enforce — this one IS enforced, on
INSERT, UPDATE and MERGE alike (live-verified). Rows already in the table when it is added are left
alone, which is what
ENABLE NOVALIDATE says.
The expression is kept as the TEXT it was written as, because that text is what every readback
surface shows: DESCRIBE's check cell, GET_DDL's constraint line and the violation message
all quote it verbatim, case and spacing included.
-
Constructor Summary
ConstructorsConstructorDescriptionCheckConstraint(String name, String expression, boolean autoNamed, List<String> referencedColumns) -
Method Summary
Modifier and TypeMethodDescriptionThe single column DESCRIBE hangs this check on, or null when there is not exactly one.getName()How a violation names this constraint: an explicit name bare, a generated one in quotes.boolean
-
Constructor Details
-
CheckConstraint
public CheckConstraint(String name, String expression, boolean autoNamed, List<String> referencedColumns) - Parameters:
name- the constraint's name — an explicit one, or a generated SYS_CONSTRAINT_*expression- the boolean expression, verbatim as writtenautoNamed- whether the name was generated rather than written (live quotes those in the violation message and leaves an explicit name bare)referencedColumns- the table columns the expression names, in the order it names them
-
-
Method Details
-
getName
-
getExpression
-
isAutoNamed
public boolean isAutoNamed() -
getReferencedColumns
-
getReportedName
How a violation names this constraint: an explicit name bare, a generated one in quotes. -
describedColumn
The single column DESCRIBE hangs this check on, or null when there is not exactly one. A check spanning two columns appears in NO column's cell, and neither does one naming none (live-verified).
-