final class Names
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.

Lowers identifiers and the name forms built from them.

Rule: PG-NAME-001. Scope: ColId, ColLabel, BareColLabel, type_function_name, NonReservedWord, name, attr_name, param_name, columnElem, generic_option_name, name_list, opt_name_list, columnList, opt_column_list, qualified_name, qualified_name_list, any_name, any_name_list, attrs, func_name, opt_single_name, opt_qualified_name, opt_collate, opt_collate_clause. Constructors: Name, QualifiedName, DottedName. An identifier is decoded by PG-IDENT-001, a keyword by PG-KEYWORD-NAME-001. A relation name and a function name written with an indirection accept field selections only and a relation name at most three parts; the server rejects anything else while parsing, so it is SQL outside the grammar. Termination: lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe hub
public function token(Token $identifier): Name

Lowers an identifier token.

Parameters

$identifierToken

Returns

Calls 3
public function text(Node $name): string

Reads the decoded text of a single name without creating an operand, for rules that decide by the word.

Parameters

$nameNode

Returns

string

Throws

ImplementationGap When the production has no rule
Called from 1
Calls 6
public function names(Node $list): list<Name>

Lowers a name list: name_list, opt_name_list, columnList or opt_column_list; an absent optional list is empty.

Parameters

$listNode

Returns

list<Name>

Throws

ImplementationGap When the production has no rule
Calls 3
public function attributes(Node $attributes): list<Name>

Lowers attrs: the names after the dots.

Parameters

$attributesNode

Returns

list<Name>
Called from 1
Calls 2
public function fields(Node $indirection): list<Name>

Lowers an indirection that the grammar action accepts as field selections only.

Parameters

$indirectionNode

Returns

list<Name>

Throws

AnalysisException When the indirection holds a subscript, a slice or a star, which `check_qualified_name` and `check_func_name` of `gram.y` reject in a name
Called from 2
Calls 1
public function dottedList(Node $list): list<DottedName>

Lowers any_name_list.

Parameters

$listNode

Returns

Calls 2
public function qualified(Node $name): QualifiedName

Lowers qualified_name: a relation name of one to three parts.

Parameters

$nameNode

Throws

AnalysisException When the name has more than three parts, which `makeRangeVarFromQualifiedName` of `gram.y` rejects
ImplementationGap When the production has no rule
Called from 1
Calls 6
public function qualifiedList(Node $list): list<QualifiedName>

Lowers qualified_name_list.

Parameters

$listNode

Returns

Calls 2
public function optional(Node $name): ?Name

Lowers opt_single_name: a name or nothing.

Parameters

$nameNode

Returns

Throws

ImplementationGap When the production has no rule
Calls 2
public function optionalDotted(Node $name): ?DottedName

Lowers opt_qualified_name, opt_collate or opt_collate_clause: a dotted name or nothing.

Parameters

$nameNode

Returns

Throws

ImplementationGap When the production has no rule
Calls 2

Private surface 2§

Implementation details, listed for orientation only.

private const FORMS = ['ColId: IDENT' => 0, 'ColId: unreserved_keyword' => 1, 'ColId: col_name_keywor…
private Lowering $lowering

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 1
Type declarations 1