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

A CHECK column constraint: a condition every row satisfies.

Mirrors CONSTR_CHECK with raw_expr and is_no_inherit. The condition is derived where the columns of the table are visible (PG-TABLE-CONDITION-001); a column constraint may refer to any column. Source: https://www.postgresql.org/docs/17/sql-createtable.html, https://www.postgresql.org/docs/17/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS.

A check refers to the columns of its tabledoctest
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (a int CHECK (a > 0) NO INHERIT)');
    $check = $create->statement->definition->elements[0]->qualifiers[0];
    [$check->noInherit, $create->facts->scalar($check->condition->left)->resolution->slot->column === $create->declarations()[0]->columns[0]] // => [true, true]

Properties§

public Scalar $condition
public bool $noInherit = false
public Name|null $name = null

Methods§

public function __construct(
    public Scalar $condition,
    public bool $noInherit = false,
    public Name|null $name = null,
)

Parameters

$conditionScalarThe condition
$noInheritboolWhether NO INHERIT is written: the constraint does not apply to child tables
$nameName|nullThe constraint name
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.

Parameters

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

Writes the constraint.

Parameters

$outOutput
Calls 3

Test cases 2§

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

Dedicated tests 2

Relations§

Instantiated in 1
Constant reads 1
Type checks 1