classColumnFacts
final class ColumnFacts
Resolves a dotted column reference and derives its facts.
Rule: PG-COLUMN-FACTS-001. A one-part name at a position that offers output columns by name refers to the one output column of that name, and two such columns are ambiguous. Otherwise the last part is a column and the parts before it are the relation, schema and catalog qualifiers, resolved by CORE-COLUMN-LOOKUP-001; a reference that reaches a relation a lateral item must not reference is reported (PG-LATERAL-JOIN-001). A one-part name that no column answers to is the whole row of a visible relation of that name (PG-WHOLE-ROW-001). More than four parts are an improper name. Termination: one lookup through finite levels. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SQL-EXPRESSIONS-COLUMN-REFS, https://www.postgresql.org/docs/17/sql-select.html#SQL-ORDERBY. Status: Implemented.
Methods§
public function derive(
Derivation $derivation,
Environment $environment,
non-empty-list<Name> $parts,
): ScalarFactDerives the facts of a column reference written with the given parts.
Parameters
$derivation | Derivation | |
$environment | Environment | |
$parts | non-empty-list<Name> |
Returns
Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\ColumnReference::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/ColumnReference.php:74
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Index\ColumnKey::deriveScalar() packages/sql-semantics-postgres/src/Statement/Table/Index/ColumnKey.php:47
Calls 23
- function-call
countline 54 - new ImproperName line 56
- new DottedName line 56
- method-call Derivation::report() line 57
- new ScalarFact line 59
- new Invalid line 59
- class-const Nullability::Dependent() line 59
- method-call Environment::aliased() line 61
- method-call ColumnFacts::alias() line 62
- method-call DottedName::qualified() line 64
- function-call
array_sliceline 64 - method-call ColumnLookup::find() line 65
- new ColumnLookup line 65
- method-call Visibility::unqualified() line 65
- new Visibility line 65
- new LateralReach line 66
- method-call LateralReach::reached() line 67
- method-call LateralReach::report() line 69
- new Dependent line 75
- method-call WholeRows::row() line 78
- new WholeRows line 78
- new QualifiedName line 78
- static-call Check::invariant() line 83
public function alias(Derivation $derivation, Environment $environment, Name $name): ScalarFactDerives a reference to an output column by its name.
Parameters
$derivation | Derivation | |
$environment | Environment | |
$name | Name |
Returns
Test cases 1
Called from 1
Calls 8
- method-call Environment::aliased() line 93
- function-call
countline 94 - new ScalarFact line 95
- new AliasTarget line 95
- new AmbiguousOutputName line 97
- method-call Derivation::report() line 98
- new Invalid line 100
- class-const Nullability::Dependent() line 100
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Statement\Expression\ColumnReference::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/ColumnReference.php:74
- new SqlSemantics\Platform\PostgreSql\Statement\Table\Index\ColumnKey::deriveScalar() packages/sql-semantics-postgres/src/Statement/Table/Index/ColumnKey.php:47
Method calls 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Expression\ColumnReference::deriveScalar() packages/sql-semantics-postgres/src/Statement/Expression/ColumnReference.php:74
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Index\ColumnKey::deriveScalar() packages/sql-semantics-postgres/src/Statement/Table/Index/ColumnKey.php:47