classCreateDomain
final class CreateDomain
implements Statement, Relation
uses Snapshot
@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.
$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> $constraintspublic DottedName $namepublic TypeName $typeMethods§
public function __construct(
public DottedName $name,
public TypeName $type,
list<Clause> $constraints = [],
)Parameters
$name | DottedName | The domain name |
$type | TypeName | The base type |
$constraints | list<Clause> | The constraints and the collation in the order written |
Calls 2
- static-call Check::listOf() line 55
- class-const Clause::class() line 55
public function deriveStatement(Derivation $derivation): voidDerives the base type and the constraints, which see the value as VALUE.
Parameters
$derivation | Derivation |
Calls 7
- method-call DomainChecks::constraints() line 63
- new DomainChecks line 63
- method-call TypeName::deriveClause() line 64
- new Environment line 64
- method-call DomainInput::environment() line 65
- new DomainInput line 65
- method-call TypeName::typeFact() line 65
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactAnswers the row the constraints see besides VALUE: none.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 2
- new RelationFact line 76
- new RowShape line 76
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 84
- method-call Output::node() line 86
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.