classWholeRows
final class WholeRows
Resolves a relation name used as a value: the whole row of a visible relation.
Rule: PG-WHOLE-ROW-001. The name is matched against the relations visible at the position and then at the enclosing query levels, nearest first: an alias by its name alone, an unaliased relation by its name and, when written, its schema. The nearest level with a match decides; two matches there are ambiguous; a relation a lateral item must not reference is reported (PG-LATERAL-JOIN-001). Facts: the row type of the relation, whose fields are its columns, or a dependence on the missing inputs of an open shape; a row of an outer join's NULL side is NULL, so the value can be NULL. Termination: the chain of levels and each relation list are finite. Source: https://www.postgresql.org/docs/17/rowtypes.html#ROWTYPES-USAGE, https://www.postgresql.org/docs/17/sql-expressions.html#SQL-EXPRESSIONS-COLUMN-REFS. Status: Implemented.
Methods§
public function star(
Derivation $derivation,
Environment $environment,
non-empty-list<Name> $qualifiers,
): ScalarFactDerives the whole row a name.* reference stands for; a relation that is not visible is reported.
Parameters
$derivation | Derivation | |
$environment | Environment | |
$qualifiers | non-empty-list<Name> |
Returns
Test cases 1
Called from 1
Calls 9
- method-call DottedName::qualified() line 50
- new DottedName line 50
- new ImproperName line 52
- method-call Derivation::report() line 53
- new ScalarFact line 55
- new Invalid line 55
- class-const Nullability::Dependent() line 55
- method-call WholeRows::row() line 57
- new MissingTable line 61
public function row(
Derivation $derivation,
Environment $environment,
QualifiedName $name,
): ?ScalarFactDerives the whole row of the visible relation a name matches, or answers null when none matches.
Parameters
$derivation | Derivation | |
$environment | Environment | |
$name | QualifiedName |
Returns
Test cases 3
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnFacts::derive() packages/sql-semantics-postgres/src/Rules/Expression/ColumnFacts.php:78
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\WholeRows::star() packages/sql-semantics-postgres/src/Rules/Expression/WholeRows.php:57
Calls 14
- method-call WholeRows::find() line 72
- function-call
countline 76 - new AmbiguousRelation line 77
- method-call Derivation::report() line 78
- new ScalarFact line 80
- new Invalid line 80
- class-const Nullability::Dependent() line 80
- new LateralReach line 83
- method-call LateralReach::barred() line 84
- method-call LateralReach::report() line 85
- new Dependent line 88
- new Known line 91
- new Composite line 91
- class-const Nullability::Nullable() line 91
public function find(Environment $environment, QualifiedName $name): list<VisibleRelation>Answers the relations of the nearest level that the name matches.
Parameters
$environment | Environment | |
$name | QualifiedName |
Returns
list<VisibleRelation>Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\WholeRows::row() packages/sql-semantics-postgres/src/Rules/Expression/WholeRows.php:72
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\LateralReach::reached() packages/sql-semantics-postgres/src/Rules/Resolution/LateralReach.php:77
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnFacts::derive() packages/sql-semantics-postgres/src/Rules/Expression/ColumnFacts.php:78
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\LateralReach::reached() packages/sql-semantics-postgres/src/Rules/Resolution/LateralReach.php:77
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\ColumnStar::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/ColumnStar.php:68
Method calls 3
- method-call SqlSemantics\Platform\PostgreSql\Rules\Expression\ColumnFacts::derive() packages/sql-semantics-postgres/src/Rules/Expression/ColumnFacts.php:78
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\LateralReach::reached() packages/sql-semantics-postgres/src/Rules/Resolution/LateralReach.php:77
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\ColumnStar::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/ColumnStar.php:68