classStarExpansion
final class StarExpansion
Expands the stars of a select list into output fields.
Rule: PG-STAR-001. * selects, in FROM order, every column a FROM item shows to unqualified names: the columns of a join with the merged USING and NATURAL columns once and first, and no column of a relation reachable by qualifier only. Without any FROM item it is reported. t.* selects every column of the relation the qualifier names, at the nearest query level that has one, including the columns merged by a join. A relation whose columns are not all known contributes its known columns and an open star naming the missing inputs. (value).* selects the fields of a composite value, which the context cannot describe: the shape is open on the inputs the value depends on, and a value of a known type that is not composite is reported. Every field refers to the slot it selects. Terminates: one pass over the relations of a level. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-SELECT-LIST, https://www.postgresql.org/docs/17/rowtypes.html#ROWTYPES-USAGE. Status: Implemented.
Methods§
public function all(
Derivation $derivation,
Environment $environment,
int $position,
): list<Field|OpenStar>Expands * over the relations of the level of an environment.
Parameters
$derivation | Derivation | |
$environment | Environment | |
$position | int |
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:109
- method-call SqlSemantics\Platform\PostgreSql\Statement\Query\StarTarget::project() packages/sql-semantics-postgres/src/Statement/Query/StarTarget.php:34
Calls 6
- new Visibility line 52
- method-call Visibility::restricted() line 56
- method-call StarExpansion::expand() line 60
- method-call Derivation::report() line 63
- new QueryMisuse line 63
- class-const QueryMisuseRule::StarWithoutTables() line 63
public function qualified(
Environment $environment,
non-empty-list<Name> $qualifiers,
int $position,
): list<Field|OpenStar>Expands qualifier.* over the relation the qualifier names at the nearest level that has one.
Parameters
$environment | Environment | |
$qualifiers | non-empty-list<Name> | |
$position | int |
Called from 1
Calls 5
- method-call DottedName::qualified() line 77
- new DottedName line 77
- new Visibility line 81
- method-call Visibility::admits() line 85
- method-call StarExpansion::expand() line 86
public function composite(Derivation $derivation, ScalarFact $fact): list<Field|OpenStar>Expands the fields of a composite value from its facts.
Parameters
$derivation | Derivation | |
$fact | ScalarFact |
Called from 1
Calls 5
- new OpenStar line 105
- method-call Derivation::report() line 108
- new QueryMisuse line 108
- class-const QueryMisuseRule::NotComposite() line 108
- new Name line 108
public function expand(
list<Field|OpenStar> $items,
VisibleRelation $relation,
bool $unqualified,
int $position,
): list<Field|OpenStar>Appends the slots of one relation, skipping hidden slots when the star is unqualified.
Parameters
$items | list<Field|OpenStar> | |
$relation | VisibleRelation | |
$unqualified | bool | |
$position | int |
Called from 2
Calls 6
- function-call
in_arrayline 123 - new Field line 124
- function-call
countline 124 - new OutputSlot line 124
- new ResolvedColumn line 124
- new OpenStar line 128
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
StarExpansionTestcalls
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:109
- new SqlSemantics\Platform\PostgreSql\Statement\Query\ExpressionTarget::project() packages/sql-semantics-postgres/src/Statement/Query/ExpressionTarget.php:70
- new SqlSemantics\Platform\PostgreSql\Statement\Query\ExpressionTarget::project() packages/sql-semantics-postgres/src/Statement/Query/ExpressionTarget.php:73
- new SqlSemantics\Platform\PostgreSql\Statement\Query\StarTarget::project() packages/sql-semantics-postgres/src/Statement/Query/StarTarget.php:34
Method calls 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\SelectFacts::table() packages/sql-semantics-postgres/src/Rules/Query/Facts/SelectFacts.php:109
- method-call SqlSemantics\Platform\PostgreSql\Statement\Query\ExpressionTarget::project() packages/sql-semantics-postgres/src/Statement/Query/ExpressionTarget.php:70
- method-call SqlSemantics\Platform\PostgreSql\Statement\Query\ExpressionTarget::project() packages/sql-semantics-postgres/src/Statement/Query/ExpressionTarget.php:73
- method-call SqlSemantics\Platform\PostgreSql\Statement\Query\StarTarget::project() packages/sql-semantics-postgres/src/Statement/Query/StarTarget.php:34