final class ColumnCheck
    implements ColumnConstraint
    uses Snapshot
Public API: explicitly declared with @visibility public.

A CHECK column constraint.

Rule: SQLITE-COLUMN-CHECK-001. The expression is evaluated for each written row and may refer to any column of the table and to its row identifier, not only to the column it is written after. It is derived at a position whose only visible relation is the table being defined. A bound parameter or a subquery in it is a diagnostic (SQLITE-DEFINITION-LIMITS-001). Source: https://sqlite.org/lang_createtable.html#check_constraints. Status: Implemented.

Resolving a column inside a CHECK constraint to the column being defineddoctest
$create = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE TABLE t (a INT CHECK (a > 0))');
    $check = $create->statement->columns[0]->constraints[0];
    $create->facts->scalar($check->expression->left)->resolution->slot->column === $create->declarations()[0]->columns[0] // => true

Properties§

public Scalar $expression

Methods§

public function __construct(public Scalar $expression)

Parameters

$expressionScalarThe condition every row must not fail
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): void

Derives the condition where the columns and the row identifier of the table are visible.

Parameters

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

Writes the clause.

Parameters

$outOutput
Calls 1

Test cases 5§

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

Dedicated tests 2
Other tests reaching this symbol 3

Relations§

Instantiated in 1