classFromRule
final class FromRule
Lowers FROM clauses and their items.
Rule: PG-FROM-LOWER-001. Scope: from_clause, from_list, table_ref, joined_table, join_type, opt_outer, join_qual, alias_clause, opt_alias_clause, opt_alias_clause_for_join_using, func_alias_clause, relation_expr, extended_relation_expr, relation_expr_list, tablesample_clause, opt_repeatable_clause, func_table, rowsfrom_list, rowsfrom_item, opt_col_def_list, opt_ordinality. Constructors: TableInput, RelationReference, TableSample, DerivedTable, FunctionTable, TableFunction, Join, JoinOn, JoinUsing, ParenthesizedJoin, RelationList. Several comma-separated items become a RelationList; one item stays itself. INNER and OUTER are noise words. Termination: lists are flattened iteratively; joins recurse on the tree depth. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-FROM. Status: Implemented.
Methods§
Lowers from_clause to its one item or the list of its items; no clause is null.
Parameters
$clause | Node |
Returns
Test cases 1
Called from 2
Calls 3
- method-call FromRule::items() line 70
- function-call
countline 72 - new RelationList line 75
Lowers from_clause or from_list; no clause is an empty list.
Parameters
$clause | Node |
Returns
list<Relation>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Calls 3
- static-call ImplementationGap::production() line 93
- method-call Lowering::items() line 96
- method-call FromRule::reference() line 97
Lowers table_ref.
Parameters
$reference | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 7
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::items() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:97
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::joined() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:178
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::joined() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:179
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::joined() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:180
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::joined() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:181
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::joined() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:182
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::tableReference() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:126
Calls 11
- new TableFunctionRule line 111
- method-call FromRule::table() line 114
- method-call FromRule::sample() line 115
- method-call FromRule::functions() line 116
- method-call TableFunctionRule::xml() line 118
- method-call FromRule::alias() line 118
- method-call TableFunctionRule::json() line 120
- method-call FromRule::derived() line 122
- method-call FromRule::joined() line 124
- method-call FromRule::renamedJoin() line 125
- static-call ImplementationGap::production() line 126
public function table(Form $form, ?TableSample $sample): TableInputLowers a table_ref of a relation with its alias and sample.
Parameters
$form | Form | |
$sample | ?TableSample |
Returns
Test cases 1
Called from 2
Calls 4
- method-call FromRule::alias() line 135
- method-call Form::node() line 135
- new TableInput line 137
- method-call FromRule::relation() line 137
public function derived(Node $query, Node $alias, bool $lateral): DerivedTableLowers a subquery in FROM with its alias.
Returns
Test cases 1
Called from 2
Calls 4
- method-call SelectRule::withParens() line 145
- new SelectRule line 145
- method-call FromRule::alias() line 146
- new DerivedTable line 148
public function renamedJoin(Form $form): ParenthesizedJoinLowers ( joined_table ) alias_clause.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the alias is not lowered to a nameTest cases 1
Called from 1
Calls 5
- method-call FromRule::joined() line 158
- method-call Form::node() line 158
- method-call FromRule::alias() line 159
- static-call ImplementationGap::production() line 161
- new ParenthesizedJoin line 164
public function joined(Node $join): Join|ParenthesizedJoinLowers joined_table.
Parameters
$join | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::reference() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:124
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::renamedJoin() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:158
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::joined() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:177
Calls 9
- new ParenthesizedJoin line 177
- method-call FromRule::joined() line 177
- new Join line 178
- method-call FromRule::reference() line 178
- class-const JoinKind::Cross() line 178
- method-call FromRule::kind() line 179
- method-call FromRule::qualification() line 179
- class-const JoinKind::Inner() line 180
- static-call ImplementationGap::production() line 183
Lowers join_type.
Parameters
$type | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Calls 3
- class-const FromRule::KINDS() line 195
- static-call ImplementationGap::production() line 195
- class-const JoinKind::Inner() line 196
Lowers join_qual.
Parameters
$qualification | Node |
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Lowers opt_alias_clause or alias_clause: the correlation name and the column names; no alias has neither.
Parameters
$alias | Node |
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 9
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::reference() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:118
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::reference() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:119
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::reference() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:120
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::reference() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:121
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::table() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:135
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::derived() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:146
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::renamedJoin() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:159
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::alias() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:243
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::functionAlias() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:309
Calls 2
- method-call FromRule::alias() line 243
- static-call ImplementationGap::production() line 248
public function functions(Node $table, Node $alias, bool $lateral): FunctionTableLowers func_table with its func_alias_clause.
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Calls 6
- method-call FromRule::functionAlias() line 260
- new FunctionTable line 263
- new TableFunction line 263
- method-call FromRule::ordinality() line 263
- method-call FromRule::rowsFrom() line 264
- static-call ImplementationGap::production() line 265
public function rowsFrom(Node $list): list<TableFunction>Lowers rowsfrom_list.
Parameters
$list | Node |
Returns
list<TableFunction>Throws
ImplementationGap When an item has no ruleTest cases 1
Called from 1
Calls 3
- method-call Lowering::items() line 279
- static-call ImplementationGap::production() line 282
- new TableFunction line 286
public function functionAlias(Node $alias): array{Name|null, list<Name>, list<TypedColumn>}Lowers func_alias_clause: the correlation name, the column names and the column definitions.
Parameters
$alias | Node |
Returns
array{Name|null, list<Name>, list<TypedColumn>}Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call FromRule::alias() line 309
- static-call ImplementationGap::production() line 314
public function ordinality(Node $ordinality): boolLowers opt_ordinality.
Parameters
$ordinality | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Calls 1
- static-call ImplementationGap::production() line 330
public function relation(Node $relation): RelationReferenceLowers relation_expr or extended_relation_expr.
Parameters
$relation | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 5
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::table() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:137
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::relation() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:346
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\FromRule::relations() packages/sql-semantics-postgres/src/Lowering/Query/FromRule.php:363
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::relation() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:118
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::simple() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:210
Calls 3
- new RelationReference line 345
- method-call FromRule::relation() line 346
- static-call ImplementationGap::production() line 350
public function relations(Node $list): list<RelationReference>Lowers relation_expr_list.
Parameters
$list | Node |
Returns
list<RelationReference>Test cases 1
Called from 1
Calls 2
- method-call Lowering::items() line 362
- method-call FromRule::relation() line 363
public function sample(Node $clause): TableSampleLowers tablesample_clause.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- static-call ImplementationGap::production() line 378
- new TableSample line 382
Private surface 2§
Implementation details, listed for orientation only.
private const KINDS = ['join_type: FULL opt_outer' => \SqlSemantics\Platform\PostgreSql\Statement\Rel…private Lowering $loweringTest cases 17§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 17
FromRuleTest::testAliasReadsTheColumnscallsFromRuleTest::testDerivedStripsTheParenthesescallsFromRuleTest::testFunctionAliasReadsDefinitionsWithoutAliascallsFromRuleTest::testFunctionsLowersRowsFromcallsFromRuleTest::testItemIsAListForSeveralItemscallsFromRuleTest::testItemsIsEmptyWithoutFromcallsFromRuleTest::testJoinedLowersANaturalJoincallsFromRuleTest::testKindReadsLeftOutercallsFromRuleTest::testOrdinalityIsFalseWhenNotWrittencallsFromRuleTest::testQualificationReadsUsingcallsFromRuleTest::testReferenceLowersALateralSubquerycallsFromRuleTest::testRelationReadsOnlyInParenthesescallsFromRuleTest::testRelationsLowersTheListcallsFromRuleTest::testRenamedJoinKeepsTheAliascallsFromRuleTest::testRowsFromReadsTheDefinitionscallsFromRuleTest::testSampleReadsTheSeedcallsFromRuleTest::testTableLowersTheSamplecalls
Relations§
Instantiated in 7
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::from() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:102
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::fromItem() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:110
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::relation() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:118
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::tableReference() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:126
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::relations() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:136
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::simple() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:210
- new SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::selection() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:228
Method calls 7
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::from() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:102
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::fromItem() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:110
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::relation() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:118
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::tableReference() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:126
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\Queries::relations() packages/sql-semantics-postgres/src/Lowering/Query/Queries.php:136
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::simple() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:210
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Query\SelectRule::selection() packages/sql-semantics-postgres/src/Lowering/Query/SelectRule.php:228