final class AlterDomainConstraint
    implements Statement, Relation
    uses Snapshot
Public API: explicitly declared with @visibility public.

A request to add a constraint to a domain: ALTER DOMAIN name ADD constraint [ NOT VALID ].

Rule: PG-DOMAIN-002. Mirrors AlterDomainStmt subtype 'C'. Release 16 writes a table constraint, release 17 a domain constraint (DomainCheck, DomainNotNull). The constraint sees VALUE, whose type depends on the undeclared domain (PG-DOMAIN-VALUE-001); kinds a domain cannot have are diagnostics (PG-DOMAIN-CHECK-001). Source: https://www.postgresql.org/docs/17/sql-alterdomain.html. Status: Implemented.

Adding a check that depends on the domain's typedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER DOMAIN posint ADD CONSTRAINT positive CHECK (VALUE > 0) NOT VALID');
    $operation->toString() // => 'ALTER DOMAIN posint ADD CONSTRAINT positive CHECK (value > 0) NOT VALID'

Properties§

public DottedName $name
public Clause $constraint

Methods§

public function __construct(public DottedName $name, public Clause $constraint)

Parameters

$nameDottedNameThe domain name
$constraintClauseThe constraint
public function deriveStatement(Derivation $derivation): void

Derives the constraint, which sees the value as VALUE.

Parameters

$derivationDerivation
Calls 6
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Answers the row the constraint sees besides VALUE: none.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 1

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 2