classDropRole
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.
$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> $rolespublic RoleWord $wordpublic bool $ifExists = falseMethods§
public function __construct(
public RoleWord $word,
list<RoleSpec> $roles,
public bool $ifExists = false,
)Parameters
Calls 2
- static-call Check::listOf() line 47
- class-const RoleSpec::class() line 47
public function deriveStatement(Derivation $derivation): voidReports the roles that are not given by name.
Parameters
$derivation | Derivation |
Calls 2
- method-call RoleChecks::droppable() line 55
- new RoleChecks line 55
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 63
- method-call Output::list() line 67
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.