classTableShapes
final class TableShapes
Derives the row shape of one use of a named relation.
Rule: PG-TABLE-SHAPE-001. An unqualified name denotes the nearest common table of that name, then a relation found along the schema search path (CORE-TABLE-LOOKUP-001). A declared relation contributes one slot per declared column, in order, each referring to the declaration, and is open when its column list is incomplete; a common table contributes the slots it is bound with; an undeclared or conditionally resolved name contributes an open shape that names the missing declaration; a missing or conflicting name contributes an empty shape and is a diagnostic. The column aliases rename the slots (PG-COLUMN-ALIAS-001). The arguments of TABLESAMPLE see the enclosing query only; sampling anything but a table or a materialized view (a common table, or a relation declared as a view, a foreign table or a sequence, PG-RELATION-KIND-001) is reported, and so is reading a common table computed by a data-modifying statement without RETURNING. The implicit columns of a declaration are found by name only. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-FROM, https://www.postgresql.org/docs/17/ddl-schemas.html#DDL-SCHEMAS-PATH. Status: Implemented.
Methods§
public function input(
TableInput $input,
Derivation $derivation,
Environment $environment,
): RelationFactResolves the name of a table input and derives the shape of the use.
Parameters
$input | TableInput | |
$derivation | Derivation | |
$environment | Environment |
Returns
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::fact() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:35
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\TableInput::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/TableInput.php:76
Calls 16
- method-call Derivation::table() line 55
- class-const RelationKind::BaseTable() line 59
- class-const RelationKind::MaterializedView() line 59
- method-call Derivation::report() line 60
- new QueryMisuse line 60
- class-const QueryMisuseRule::TablesampleTarget() line 60
- new RowShape line 63
- new OutputSlot line 67
- method-call DeclaredTyping::fact() line 67
- new DeclaredTyping line 67
- new IncompleteMembers line 69
- method-call Environment::commonTable() line 71
- class-const QueryMisuseRule::WithoutReturning() line 74
- new RelationFact line 85
- method-call ColumnAliases::apply() line 85
- new ColumnAliases line 85
public function implicit(RelationFact $fact): list<ImplicitSlot>Answers the implicit columns of the relation a use resolved to.
Parameters
$fact | RelationFact |
Returns
list<ImplicitSlot>Test cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::visible() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:43
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::visible() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:73
Calls 4
- new ImplicitSlot line 97
- new OutputSlot line 97
- method-call DeclaredTyping::fact() line 97
- new DeclaredTyping line 97
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::fact() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:35
- new SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::visible() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:43
- new SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::visible() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:73
- new SqlSemantics\Platform\PostgreSql\Statement\Relation\TableInput::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/TableInput.php:76
Method calls 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::fact() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:35
- method-call SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets::visible() packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:43
- method-call SqlSemantics\Platform\PostgreSql\Rules\Resolution\FromScope::visible() packages/sql-semantics-postgres/src/Rules/Resolution/FromScope.php:73
- method-call SqlSemantics\Platform\PostgreSql\Statement\Relation\TableInput::deriveRelation() packages/sql-semantics-postgres/src/Statement/Relation/TableInput.php:76