classColumnAliases
final class ColumnAliases
Renames the columns of a FROM item by the column aliases written after its correlation name.
Rule: PG-COLUMN-ALIAS-001. The aliases rename the first columns in order; the remaining columns keep their names. More aliases than columns are reported when every column is known; when the columns are not all known, an alias past the known columns names a column whose type depends on the missing inputs. A renamed column refers to the column it renames. Source: https://www.postgresql.org/docs/17/queries-table-expressions.html#QUERIES-TABLE-ALIASES. Status: Implemented.
Methods§
public function apply(
RowShape $shape,
?Name $alias,
list<Name> $aliases,
Derivation $derivation,
): RowShapeAnswers the shape renamed by the aliases.
Parameters
$shape | RowShape | |
$alias | ?Name | |
$aliases | list<Name> | |
$derivation | Derivation |
Returns
Called from 6
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::enter() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:107
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\FunctionShapes::derive() packages/sql-semantics-postgres/src/Rules/Resolution/FunctionShapes.php:91
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::xml() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:79
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::json() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:135
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:85
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\DerivedTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/DerivedTable.php:63
Calls 9
- method-call RowShape::complete() line 43
- function-call
countline 43 - method-call Derivation::report() line 44
- new ArityMismatch line 44
- class-const ArityRule::ColumnAliases() line 44
- new OutputSlot line 49
- new Dependent line 52
- class-const Nullability::Dependent() line 52
- new RowShape line 55
Answers the shape a query output has as a FROM item: one slot per field, referring to it.
Parameters
$fact | QueryFact |
Returns
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::shape() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:178
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\DerivedTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/DerivedTable.php:63
Calls 2
- new OutputSlot line 66
- new RowShape line 70
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ColumnAliasesTestcalls
Relations§
Instantiated in 7
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::shape() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:178
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::enter() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:107
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\FunctionShapes::derive() packages/sql-semantics-postgres/src/Rules/Resolution/FunctionShapes.php:91
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::xml() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:79
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::json() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:135
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:85
- new SqlSemantics\Platform\PostgreSql\Statement\Relation\DerivedTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/DerivedTable.php:63
Method calls 8
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\CommonTableFacts::shape() packages/sql-semantics-postgres/src/Rules/Query/Facts/CommonTableFacts.php:178
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::enter() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:107
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\FunctionShapes::derive() packages/sql-semantics-postgres/src/Rules/Resolution/FunctionShapes.php:91
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::xml() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:79
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableFunctionShapes::json() packages/sql-semantics-postgres/src/Rules/Resolution/TableFunctionShapes.php:135
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\TableShapes::input() packages/sql-semantics-postgres/src/Rules/Resolution/TableShapes.php:85
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\DerivedTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/DerivedTable.php:63
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\DerivedTable::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/DerivedTable.php:63