final class NameArgument
    implements AttributeArgument
    uses Snapshot
Public API: explicitly declared with @visibility public.

An attribute value read as the name of an object of a fixed kind, such as the function of an operator.

defGetQualifiedName accepts a name written as a type name, an operator, a string (one name, as written) or a reserved keyword (one name, in lower case). A plain, possibly qualified, name is kept as a dotted name. A name written with type modifiers, array bounds, SETOF, %TYPE or as a type keyword is kept as that type name, of which the server reads only the names: a type keyword such as integer names pg_catalog.int4. The kind is the object the command looks the name up as; for multirange_type_name it is the type the command creates. Source: https://www.postgresql.org/docs/17/sql-createoperator.html, defGetQualifiedName in src/backend/commands/define.c of PostgreSQL 17.

Reading the function an operator callsdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE OPERATOR === (rightarg = int4, function = pg_catalog.int4eq)');
    $function = $operation->statement->definition[1]->value;
    [$function->kind->value, array_map(static fn ($part) => $part->value, $function->parts())] // => ['FUNCTION', ['pg_catalog', 'int4eq']]
Rejecting a bare type name, which is written as a dotted namedoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\NameArgument(\SqlSemantics\Platform\PostgreSql\Statement\Name\ObjectKind::Function, new \SqlSemantics\Platform\PostgreSql\Statement\Type\TypeName(new \SqlSemantics\Platform\PostgreSql\Statement\Type\Designation\NamedDesignation(new \SqlSemantics\Platform\PostgreSql\Statement\Name\DottedName([new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('f')])))) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public ObjectKind $kind

Methods§

public function __construct(
    public ObjectKind $kind,
    public DottedName|TypeName|OperatorName|StringConstant|KeywordWord $name,
)

Parameters

$kindObjectKindThe kind of object the name stands for
$nameDottedName|TypeName|OperatorName|StringConstant|KeywordWordThe name as written
Calls 5
public function parts(): non-empty-list<Name>

Answers the names the server reads, from the outermost qualifier to the object name.

Returns

non-empty-list<Name>
Test cases 1
Calls 3
public function fits(Reading $reading): bool

Tells whether the reading looks up an object of this kind.

Parameters

$readingReading

Returns

bool
Test cases 1
Calls 1
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the modifier expressions of a name written as a type name.

Parameters

$derivationDerivation
$environmentEnvironment
Test cases 1
public function render(Output $out): void

Writes the name as written; a dotted name is written where the grammar reads a type name.

Parameters

$outOutput
Test cases 2
Calls 4

Test cases 18§

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

Dedicated tests 7
Other tests reaching this symbol 11

Relations§

Instantiated in 1
Type declarations 1