final class TableInput
    implements NamedRelation
    uses Snapshot
Public API: explicitly declared with @visibility public.

One occurrence of a named table, view or common table as query input.

Mirrors PostgreSQL's RangeVar with its Alias and an optional RangeTableSample. The facts follow PG-TABLE-SHAPE-001. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-FROM. Status: Implemented.

Reading a named inputdoctest
$input = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT a FROM app.t AS x')->singleNamedInput();
    [$input->name()->schema?->value, $input->name()->name->value, $input->alias()?->value] // => ['app', 't', 'x']
Refusing column names without a correlation namedoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Relation\TableInput(new \SqlSemantics\Platform\PostgreSql\Statement\Name\RelationReference(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('t'))), null, [new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a')]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Name> $columns
public Name|null $alias = null
public TableSample|null $sample = null

Methods§

public function __construct(
    public RelationReference $table,
    public Name|null $alias = null,
    list<Name> $columns = [],
    public TableSample|null $sample = null,
)

Parameters

$tableRelationReferenceThe relation named
$aliasName|nullThe correlation name
$columnslist<Name>The column names written after the correlation name
$sampleTableSample|nullThe TABLESAMPLE clause
Calls 3
public function name(): QualifiedName

Answers the relation name.

Test cases 1
public function alias(): ?Name

Answers the correlation name.

Returns

Test cases 1
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Resolves the name and derives the row shape of the occurrence.

Parameters

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

Writes the relation, the alias and the sample.

Parameters

$outOutput
Calls 3

Test cases 25§

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

Dedicated tests 2
Other tests reaching this symbol 23

Relations§

Instantiated in 3
Type checks 6
Type declarations 3