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

Names the columns a query result has when the query is used as a relation.

Rule: SQLITE-RELATION-NAME-001. SQLite names the columns of a subquery in FROM and of a common table before it resolves the query (sqlite3ColumnsFromExprList() in select.c of release 3.47.2), from the leftmost arm of a compound query. A column takes the alias of its result column; without an alias, a result column that is one word (a column name with or without qualifier, a double-quoted word or a truth word, possibly in parentheses or under COLLATE) takes that word as written, whatever it resolves to, and any other result column takes the span of its expression (SQLITE-RESULT-NAME-001). A column a star contributes keeps the name of the column it copies. An expression of a VALUES row is named by its word, or columnN after its position when it is no word. A column that would be named TRUE or FALSE is renamed columnN. A name that repeats an earlier one, compared without regard to ASCII case, has its trailing :digits replaced by :1, :2, :3 and :4 in turn; after the fourth attempt SQLite picks the digits at random, so such a name is not fixed (a random name is taken not to repeat a later one). After a star that missing declarations prevent from expanding, or after a name that depends on missing inputs, the positions or the earlier names are unknown, so no later name is fixed: each depends on those inputs (OutputSlot::$unnamed). Every column refers to the result column it comes from. Terminates: one pass over the fields with at most four renames each. Source: https://sqlite.org/lang_select.html#the_from_clause, https://sqlite.org/c3ref/column_name.html. Status: Implemented.

Methods§

public function shape(QueryFact $fact, Query $query, Derivation $derivation): RowShape
public function named(Field $field, Select|ValuesClause $arm, int $position): ?Name

Answers the name of a column of the leftmost arm before TRUE and FALSE are renamed and duplicates are told apart.

Parameters

$fieldFieldThe output field of the arm
$armSelect|ValuesClause
$positionintThe position of the field, from zero

Returns

Test cases 2
Called from 1
Calls 5
public function unique(?Name $name, array<string, true> $seen): ?Name

Test cases 9§

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

Dedicated tests 9

Relations§

Instantiated in 6
Method calls 6