final class RoleSpec
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

A role named directly, or designated as PUBLIC, CURRENT_ROLE, CURRENT_USER or SESSION_USER.

Mirrors PostgreSQL's RoleSpec node. The word public designates every role whether or not it is quoted, and none is reserved, so neither can be the name of a named role. Source: https://www.postgresql.org/docs/17/sql-grant.html, https://www.postgresql.org/docs/17/sql-createrole.html.

Designating the current userdoctest
$role = new \SqlSemantics\Platform\PostgreSql\Statement\Name\RoleSpec(\SqlSemantics\Platform\PostgreSql\Statement\Name\RoleSpecKind::CurrentUser);
    $role->name // => null
Rejecting the reserved word as a role namedoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Name\RoleSpec(\SqlSemantics\Platform\PostgreSql\Statement\Name\RoleSpecKind::Named, new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('public')) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public Name|null $name = null

Methods§

public function __construct(public RoleSpecKind $kind, public Name|null $name = null)

Parameters

$kindRoleSpecKindHow the role is designated
$nameName|nullThe role name; given exactly when the role is named
Calls 2
public function render(Output $out): void

Test cases 15§

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

Dedicated tests 4
Other tests reaching this symbol 11

Relations§

Instantiated in 2
Constant reads 15
Type declarations 21