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

A request to remove roles, written as DROP ROLE, DROP USER or DROP GROUP.

Rule: PG-ROLE-DROP-001. Mirrors DropRoleStmt: the roles in the order written and IF EXISTS; the statement word is kept as written. Reported: a role given as PUBLIC, CURRENT_ROLE, CURRENT_USER or SESSION_USER, which DROP ROLE does not accept. Source: https://www.postgresql.org/docs/17/sql-droprole.html, https://www.postgresql.org/docs/17/sql-dropuser.html, https://www.postgresql.org/docs/17/sql-dropgroup.html. Status: Implemented.

Reading the removed rolesdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('DROP ROLE IF EXISTS joe, ann');
    [$operation->statement->ifExists, $operation->statement->roles[1]->name?->value] // => [true, 'ann']

Properties§

public non-empty-list<RoleSpec> $roles
public RoleWord $word
public bool $ifExists = false

Methods§

public function __construct(
    public RoleWord $word,
    list<RoleSpec> $roles,
    public bool $ifExists = false,
)

Parameters

$wordRoleWordThe statement word: ROLE, USER or GROUP
$roleslist<RoleSpec>The roles in the order written, at least one
$ifExistsboolWhether IF EXISTS is written
Calls 2
public function deriveStatement(Derivation $derivation): void

Reports the roles that are not given by name.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 2

Test cases 3§

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

Dedicated tests 1
Other tests reaching this symbol 2

Relations§

Instantiated in 1