final class PrivilegeChecks
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Checks the privileges of a GRANT or REVOKE against the kind of object.

Rule: PG-PRIVILEGE-CHECK-001. The server knows a fixed list of privilege names (MAINTAIN from release 17; rule is accepted and ignored) and a fixed set of them for each kind of object (the table of privileges in the manual). A name outside the list is reported as unrecognized, a known privilege outside the set of the kind as invalid for that kind. A relation named in GRANT may be a sequence, so there the sequence privileges are valid too; for default privileges only the privileges of the kind itself are. A column list is valid on relations only, limits the privilege to SELECT, INSERT, UPDATE or REFERENCES, and cannot be written for default privileges. The right to grant cannot be given to PUBLIC. The names are compared as decoded, as the server does. Termination: one pass over a finite list. Source: https://www.postgresql.org/docs/17/ddl-priv.html#PRIVILEGES-SUMMARY-TABLE, https://www.postgresql.org/docs/16/ddl-priv.html, https://www.postgresql.org/docs/17/sql-grant.html, https://www.postgresql.org/docs/17/sql-alterdefaultprivileges.html. Status: Implemented.

Methods§

public function named(
    Derivation $derivation,
    ?string $name,
    list<string> $rights,
    string $subject,
): void

Reports a privilege name that is unknown or outside the given set; ALL, which has no name, is in every set.

Parameters

$derivationDerivation
$name?string
$rightslist<string>The privilege names that apply
$subjectstringThe words the server names the kind with
Called from 2
Calls 7
public function known(Derivation $derivation, string $name): bool

Tells whether the release knows a privilege name.

Parameters

$derivationDerivation
$namestring

Returns

bool
Called from 1
Calls 3

Private surface 3§

Implementation details, listed for orientation only.

private const KNOWN = ['insert', 'select', 'update', 'delete', 'truncate', 'references', 'trigger', '…
private const RIGHTS = ['Relation' => ['insert', 'select', 'update', 'delete', 'truncate', 'references…
private const COLUMN = ['select', 'insert', 'update', 'references']

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 4
Method calls 5