final class TableTargets
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Derives the row shape of a table a definition names or defines, and the scope of the expressions inside a definition.

Rule: MYSQL-DEFINITION-SCOPE-001. A name resolves by CORE-TABLE-LOOKUP-001 in the current database or the database written; no common table is in scope of a definition. A declared table contributes one slot per declared column, in order, each referring to the declaration; its implicit columns (the INVISIBLE columns, MYSQL-TABLE-DECLARATION-001) are found by name only. An undeclared or conditionally resolved name contributes an open shape that names the missing declaration; a missing or conflicting name an empty complete shape and the diagnostic. A foreign key that names the table being defined refers to the declaration the statement provides (create-table-foreign-keys.html: "a foreign key can reference the same

  • table"). The expressions of a definition (DEFAULT expressions, generated

column expressions, CHECK conditions and functional key parts) see the columns of the table being defined or indexed, unqualified or qualified by the table name, and nothing else. Terminates: one pass over the columns. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html, https://dev.mysql.com/doc/refman/8.4/en/create-table-check-constraints.html, https://dev.mysql.com/doc/refman/8.4/en/invisible-columns.html. Status: Implemented.

Methods§

public function parent(
    Derivation $derivation,
    QualifiedName $name,
    Table|null $defined,
    QualifiedName|null $definedName,
): RelationFact

Resolves the parent table of a reference: the table being defined when the reference names it, otherwise an existing table.

Parameters

$derivationDerivation
$nameQualifiedName
$definedTable|nullThe declaration of the table being defined
$definedNameQualifiedName|nullThe name the statement writes for that table
Test cases 1
Called from 1
Calls 4
public function scope(
    Derivation $derivation,
    Relation $relation,
    QualifiedName $name,
    RowShape $shape,
    list<ImplicitSlot> $implicit = [],
): Environment

Answers the position inside a definition: its only visible relation is the table, found by its name.

Parameters

$derivationDerivation
$relationRelationThe statement node that stands for the table
$nameQualifiedNameThe name that qualifies its columns
$shapeRowShapeThe row shape of the table
$implicitlist<ImplicitSlot>The slots found by name only
Test cases 1
Called from 2
Calls 2

Test cases 5§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5

Relations§

Instantiated in 7
Method calls 9