final class TableCheck
    implements Constraint
    uses Snapshot
Public API: explicitly declared with @visibility public.

A CHECK table constraint: a condition every row satisfies.

Mirrors CONSTR_CHECK with raw_expr, skip_validation (NOT VALID) and is_no_inherit. The condition is derived where the columns of the table are visible (PG-TABLE-CONDITION-001); the attributes are checked by PG-CONSTRAINT-ATTRIBUTES-001. Source: https://www.postgresql.org/docs/17/sql-createtable.html.

Reading a check that is not validateddoctest
$alter = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int, CONSTRAINT positive CHECK (a > 0) NOT VALID)');
    [$alter->statement->definition->elements[1]->name->value, $alter->statement->definition->elements[1]->attributes] // => ['positive', [\SqlSemantics\Platform\PostgreSql\Statement\Constraint\ConstraintAttribute::NotValid]]

Properties§

public list<ConstraintAttribute> $attributes
public Scalar $condition
public Name|null $name = null

Methods§

public function __construct(
    public Scalar $condition,
    list<ConstraintAttribute> $attributes = [],
    public Name|null $name = null,
)

Parameters

$conditionScalarThe condition
$attributeslist<ConstraintAttribute>The attributes in the order written
$nameName|nullThe constraint name
Calls 2
public function kind(): ConstraintKind

Answers the kind of the constraint.

Calls 1
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the condition against the table and checks the attributes.

Parameters

$derivationDerivation
$environmentEnvironment
Calls 4
public function render(Output $out): void

Writes the constraint.

Parameters

$outOutput
Calls 4

Test cases 2§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Constant reads 1