classRelationsTarget
final class RelationsTarget
implements PrivilegeTarget
uses Snapshot
@visibility public.Relations or sequences named as the objects of a GRANT or REVOKE.
The word TABLE before relations is optional and always written back. Each relation is resolved against the context and its column privileges are checked (PG-GRANT-RELATION-001). A sequence is not resolved, since the server also creates sequences no statement declares (serial and identity columns); a name that resolves to a declaration of another kind is reported ("t" is not a sequence, PG-RELATION-KIND-001). Source: https://www.postgresql.org/docs/17/sql-grant.html.
$semantics = new \SqlSemantics\Platform\PostgreSql\Semantics();
$table = $semantics->analyze('CREATE TABLE items (id int4, price int4)');
$operation = $semantics->analyze('GRANT SELECT ON items TO joe', [$table]);
$operation->facts->relation($operation->statement->target->relations[0])->table->table === $table->declarations()[0] // => trueProperties§
public non-empty-list<RelationReference> $relationspublic PrivilegeObjectKind $objectMethods§
public function __construct(
public PrivilegeObjectKind $object,
list<RelationReference> $relations,
)Parameters
$object | PrivilegeObjectKind | The kind: relations or sequences |
$relations | list<RelationReference> | The relations in the order written, at least one, none limited with ONLY |
Calls 5
- static-call Check::input() line 50
- class-const PrivilegeObjectKind::Relation() line 50
- class-const PrivilegeObjectKind::Sequence() line 50
- static-call Check::listOf() line 51
- class-const RelationReference::class() line 51
public function object(): PrivilegeObjectKindAnswers the kind of the objects.
Returns
Test cases 1
public function deriveTarget(Derivation $derivation, array $privileges): voidResolves each relation and checks its column privileges; sequences are not resolved.
Parameters
$derivation | Derivation | |
$privileges | array |
Calls 8
- class-const PrivilegeObjectKind::Relation() line 70
- method-call GrantedRelations::derive() line 72
- new GrantedRelations line 72
- new RelationKinds line 75
- method-call RelationKinds::require() line 77
- method-call RelationKinds::declared() line 77
- class-const RelationKind::Sequence() line 77
- class-const KindRule::NotSequence() line 77
public function render(Output $out): voidTest cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.