classTableInput
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.
$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']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\InvalidConstructionProperties§
public list<Name> $columnspublic RelationReference $tablepublic Name|null $alias = nullpublic TableSample|null $sample = nullMethods§
public function __construct(
public RelationReference $table,
public Name|null $alias = null,
list<Name> $columns = [],
public TableSample|null $sample = null,
)Parameters
$table | RelationReference | The relation named |
$alias | Name|null | The correlation name |
$columns | list<Name> | The column names written after the correlation name |
$sample | TableSample|null | The TABLESAMPLE clause |
Calls 3
- static-call Check::listOf() line 51
- class-const Name::class() line 51
- static-call Check::input() line 52
public function name(): QualifiedNameAnswers the relation name.
Returns
Test cases 1
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactResolves the name and derives the row shape of the occurrence.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 2
- method-call TableShapes::input() line 76
- new TableShapes line 76
public function render(Output $out): voidWrites the relation, the alias and the sample.
Parameters
$out | Output |
Calls 3
- method-call Output::node() line 84
- method-call AliasSpelling::write() line 85
- new AliasSpelling line 85
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
QueriesTest::testFromItemIsTheOnlyItemcallsCommonTableFactsTest::testBindMakesTheTablesVisiblecallsCommonTableFactsTest::testMarkIsTheCommonTypeOfTheValuescallsCommonTableFactsTest::testMemberReportsASearchColumnTheTableLackscallsCommonTableFactsTest::testOrderDerivesReferencedTablesFirstcallsCommonTableFactsTest::testRecursiveFormReportsAQueryWithoutUnioncallsCommonTableFactsTest::testShapeAddsTheSearchAndCycleColumnscallsCommonTableFactsTest::testUsesListsTheReadRelationscallsSetOperationFactsTest::testReboundBindsTheRecursiveTablecallsLockingTest::testTablesMarksTheNullableSidescallsJoiningTest::testExtendedMakesEverySlotNullablecallsLateralReachTest::testBarMarksEveryRelationOncecallsLateralReachTest::testBarredTellsABarredRelationcallsLateralReachTest::testReachedFindsTheBarredRelationOfAQualifiercallsLateralReachTest::testReachedFindsTheBarredRelationOfAResolvedColumncallsTableShapesTest::testInputReportsASampleOfACommonTablecallsVisibilityTest::testAdmitsMatchesTheNameAndSchemacallsVisibilityTest::testQualifiedOnlyHidesEverySlotcallsVisibilityTest::testRestrictedTellsAQualifiedOnlyRelationcallsVisibilityTest::testStarSkipsQualifiedOnlyRelationscallsVisibilityTest::testUnhiddenSkipsHiddenSlotscallsVisibilityTest::testUnqualifiedDropsTheSystemColumnsOfQualifiedOnlyRelationscallsVisibilityTest::testUnqualifiedKeepsAnEnvironmentWithoutQualifiedOnlyRelationscalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::table() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:137
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::simple() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:210
- new SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::fact() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:35
Type checks 6
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::uses() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:117
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Locking::check() packages/sql-semantics-postgres/src/Rules/Query/Locking.php:75
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Locking::refused() packages/sql-semantics-postgres/src/Rules/Query/Locking.php:142
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Locking::tables() packages/sql-semantics-postgres/src/Rules/Query/Locking.php:155
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::visible() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:72
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Table\Index\CreateStatistics::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Index/CreateStatistics.php:84
Type declarations 3
- type SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:133
- type SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:53
- type SqlSemantics\Platform\PostgreSql\Statement\Query\TableQuery packages/sql-semantics-postgres/src/Statement/Query/TableQuery.php:47