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

A request to define a domain: a base type with a default, a collation and constraints.

Rule: PG-DOMAIN-001. Mirrors CreateDomainStmt: name, base type and the constraints and collation in the order written; the optional AS is not kept. The constraint expressions see the value being checked as VALUE, of the base type (PG-DOMAIN-VALUE-001); the statement is the relation occurrence that offers it, with an empty row. Constraints a domain cannot have are diagnostics (PG-DOMAIN-CHECK-001). A domain is a type, not a relation, so the statement provides no declaration. Source: https://www.postgresql.org/docs/17/sql-createdomain.html. Status: Implemented.

Resolving VALUE in a domain constraint to the base typedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE DOMAIN posint AS int4 CHECK (VALUE > 0)');
    [$operation->facts->diagnostics, $operation->toString()] // => [[], 'CREATE DOMAIN posint int4 CHECK (value > 0)']

Properties§

public list<Clause> $constraints
public DottedName $name
public TypeName $type

Methods§

public function __construct(
    public DottedName $name,
    public TypeName $type,
    list<Clause> $constraints = [],
)

Parameters

$nameDottedNameThe domain name
$typeTypeNameThe base type
$constraintslist<Clause>The constraints and the collation in the order written
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives the base type and the constraints, which see the value as VALUE.

Parameters

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

Answers the row the constraints see besides VALUE: none.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 2

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 1