classDomainCheck
final class DomainCheck
implements Clause
uses Snapshot
Public API: explicitly declared with
@visibility public.A CHECK constraint added to a domain in release 17: [ CONSTRAINT name ] CHECK ( expression ) attributes.
Mirrors the Constraint of kind CONSTR_CHECK that DomainConstraintElem builds. NOT VALID skips checking existing values; deferral and NO INHERIT are diagnostics (PG-DOMAIN-CHECK-001). Source: https://www.postgresql.org/docs/17/sql-alterdomain.html.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER DOMAIN d ADD CHECK (VALUE <> 0) NOT VALID');
$operation->statement->constraint->attributes // => [\SqlSemantics\Platform\PostgreSql\Statement\Constraint\ConstraintAttribute::NotValid]Properties§
public list<ConstraintAttribute> $attributespublic Name|null $namepublic Scalar $conditionMethods§
public function __construct(
public Name|null $name,
public Scalar $condition,
list<ConstraintAttribute> $attributes = [],
)Parameters
$name | Name|null | The constraint name, when CONSTRAINT is written |
$condition | Scalar | The condition |
$attributes | list<ConstraintAttribute> | The attributes in the order written |
Calls 2
- static-call Check::listOf() line 48
- class-const ConstraintAttribute::class() line 48
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the condition where VALUE is visible and checks the attributes.
Parameters
$derivation | Derivation | |
$environment | Environment |
Calls 3
- method-call Derivation::scalar() line 56
- method-call DomainChecks::attributes() line 57
- new DomainChecks line 57
public function render(Output $out): voidWrites the constraint.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 66
- class-const NameUse::Column() line 66
- method-call Output::node() line 70
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DomainCheckTestcalls