final class Attribute
    implements Clause
    uses Snapshot
Public API: explicitly declared with @visibility public.

One attribute of a definition, name or name = value, as the defining command reads it.

Mirrors PostgreSQL's DefElem together with the meaning its command gives it. A recognized attribute names the member of the command's attribute set and holds its value read the way the command reads it, such as a routine name for function or a type for leftarg. The value stays as written when the command does not read it: for an attribute the command does not recognize, for an option of a text search template, for an obsolete attribute whose value is ignored, and for a value the command rejects, such as a number where it expects a name. Source: https://www.postgresql.org/docs/17/sql-createoperator.html, src/backend/commands/define.c of PostgreSQL 17.

Reading a recognized attributedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE OPERATOR === (leftarg = int4, rightarg = int4, function = int4eq)');
    $attribute = $operation->statement->definition[2];
    [$attribute->known, $attribute->value->kind] // => [\SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Known\OperatorAttribute::Function, \SqlSemantics\Platform\PostgreSql\Statement\Name\ObjectKind::Function]
Rejecting a recognized attribute whose value is left as written although the command reads itdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Attribute(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('function'), \SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Known\OperatorAttribute::Function, new \SqlSemantics\Platform\PostgreSql\Statement\Literal\StringConstant('int4eq')) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public Name $name
public KnownAttribute|null $known

Methods§

public function __construct(
    public Name $name,
    public KnownAttribute|null $known,
    public AttributeArgument|TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant|null $value = null,
)

Parameters

$nameNameThe attribute name as written, decoded
$knownKnownAttribute|nullThe member of the command's attribute set the name is; null when the command does not recognize the name
$valueAttributeArgument|TypeName|KeywordWord|OperatorName|SignedNumber|StringConstant|nullThe value as the command reads it, or as written when the command does not read it; null when given alone
Calls 3
public function deriveClause(Derivation $derivation, Environment $environment): void
public function render(Output $out): void

Writes the name and the value.

Parameters

$outOutput
Test cases 1
Calls 4

Test cases 26§

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

Dedicated tests 8
Other tests reaching this symbol 18

Relations§

Instantiated in 1
Method calls 2
Constant reads 2
Type declarations 5