final class AlterRole
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

A request to change the attributes of a role, written as ALTER ROLE or ALTER USER.

Rule: PG-ROLE-ALTER-001. Mirrors AlterRoleStmt with action +1: the role and the options in the order written. ALTER accepts the options of AlterOptRoleElem only, so SYSID, ADMIN, ROLE, IN ROLE and IN GROUP cannot be written; USER lists members to add. The optional WITH is not kept. Reported: PUBLIC or a pg_ name as the role, and the option problems of PG-ROLE-CHECK-001. Source: https://www.postgresql.org/docs/17/sql-alterrole.html, https://www.postgresql.org/docs/17/sql-alteruser.html. Status: Implemented.

Reading the role and its changed attributedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER ROLE joe WITH NOSUPERUSER');
    [$operation->statement->role->name?->value, $operation->statement->options[0]->flag()?->enabled()] // => ['joe', false]

Properties§

public list<RoleOption> $options
public RoleWord $word
public RoleSpec $role

Methods§

public function __construct(
    public RoleWord $word,
    public RoleSpec $role,
    list<RoleOption> $options = [],
)

Parameters

$wordRoleWordThe statement word: ROLE or USER
$roleRoleSpecThe role to change
$optionslist<RoleOption>The options in the order written
Calls 5
public function deriveStatement(Derivation $derivation): void

Reports the problems of the role and of the options.

Parameters

$derivationDerivation
Calls 3
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 2

Test cases 2§

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

Dedicated tests 2

Relations§

Instantiated in 2