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

A request to revoke privileges on objects, or only the right to grant them, from roles.

Rule: PG-REVOKE-001. Mirrors GrantStmt without is_grant: the privileges (an empty list is ALL PRIVILEGES), the objects, the roles, GRANT OPTION FOR, GRANTED BY and CASCADE or RESTRICT as written. The objects and privileges are derived and checked as for GRANT. Source: https://www.postgresql.org/docs/17/sql-revoke.html. Status: Implemented.

Reading the parts of a revokedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('REVOKE GRANT OPTION FOR SELECT ON accounts FROM joe CASCADE');
    [$operation->statement->grantOptionOnly, $operation->statement->behavior?->value] // => [true, 'CASCADE']

Properties§

public list<Privilege> $privileges
public non-empty-list<RoleSpec> $grantees
public bool $grantOptionOnly = false
public RoleSpec|null $grantor = null
public DropBehavior|null $behavior = null

Methods§

public function __construct(
    list<Privilege> $privileges,
    public PrivilegeTarget $target,
    list<RoleSpec> $grantees,
    public bool $grantOptionOnly = false,
    public RoleSpec|null $grantor = null,
    public DropBehavior|null $behavior = null,
)

Parameters

$privilegeslist<Privilege>The privileges in the order written; empty for ALL PRIVILEGES
$targetPrivilegeTargetThe objects the privileges are revoked on
$granteeslist<RoleSpec>The roles the privileges are revoked from, at least one
$grantOptionOnlyboolWhether GRANT OPTION FOR is written: only the right to grant is revoked
$grantorRoleSpec|nullThe role of GRANTED BY, when written
$behaviorDropBehavior|nullCASCADE or RESTRICT, when written
Calls 4
public function deriveStatement(Derivation $derivation): void

Derives the objects and reports the problems of the privileges and the grantor.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 3

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