final class Privilege
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

One privilege of a GRANT or REVOKE, optionally limited to columns; in a role grant, the granted role.

Mirrors AccessPriv: a privilege name and a column list. The name is one of the keyword spellings or an identifier such as insert or usage; ALL with a column list is the privilege without a name. The grammar reads the roles of GRANT role TO role with the same production, so there the name is the role name, and a keyword spelling names the role of that word. Source: https://www.postgresql.org/docs/17/sql-grant.html.

Reading a column privilegedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('GRANT UPDATE (price) ON items TO joe');
    [$operation->statement->privileges[0]->privilege(), $operation->statement->privileges[0]->columns[0]->value] // => ['update', 'price']
Rejecting ALL without a column list as a privilege of its owndoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Catalog\Access\Privilege\Privilege(\SqlSemantics\Platform\PostgreSql\Statement\Catalog\Access\Privilege\PrivilegeKeyword::All) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Name> $columns

Methods§

public function __construct(public PrivilegeKeyword|Name $name, list<Name> $columns = [])

Parameters

$namePrivilegeKeyword|NameThe keyword spelling or the identifier that names the privilege
$columnslist<Name>The columns the privilege is limited to; empty when no column list is written
Calls 5
public function render(Output $out): void

Writes the name and the column list, if any.

Parameters

$outOutput
Calls 5

Test cases 9§

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

Dedicated tests 5
Other tests reaching this symbol 4

Relations§

Instantiated in 7
Method calls 1
Constant reads 2
Type declarations 2