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

A request to remove roles from the membership of other roles, or to remove one membership option only.

Rule: PG-REVOKE-ROLE-001. Mirrors GrantRoleStmt without is_grant: the revoked roles, the member roles, the option of name OPTION FOR (the membership stays and only that option is turned off), GRANTED BY and CASCADE or RESTRICT as written. Checked as a role grant (PG-MEMBERSHIP-CHECK-001). Source: https://www.postgresql.org/docs/17/sql-revoke.html. Status: Implemented.

Reading the option a revoke turns offdoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('REVOKE ADMIN OPTION FOR staff FROM joe');
    [$operation->statement->option?->value, $operation->statement->roles[0]->privilege()] // => ['admin', 'staff']

Properties§

public non-empty-list<Privilege> $roles
public non-empty-list<RoleSpec> $members
public Name|null $option = null
public RoleSpec|null $grantor = null
public DropBehavior|null $behavior = null

Methods§

public function __construct(
    list<Privilege> $roles,
    list<RoleSpec> $members,
    public Name|null $option = null,
    public RoleSpec|null $grantor = null,
    public DropBehavior|null $behavior = null,
)

Parameters

$roleslist<Privilege>The revoked roles in the order written, at least one
$memberslist<RoleSpec>The roles that lose the membership, at least one
$optionName|nullThe option of `name OPTION FOR`, when written
$grantorRoleSpec|nullThe role of GRANTED BY, when written
$behaviorDropBehavior|nullCASCADE or RESTRICT, when written
Calls 4
public function deriveStatement(Derivation $derivation): void

Reports the problems of the roles and of the option.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 4

Test cases 3§

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

Dedicated tests 2
Other tests reaching this symbol 1

Relations§

Instantiated in 2