classPolicies
final class Policies
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.
Derives and writes row security policies.
Rule: PG-POLICY-001. The table is resolved (PG-TABLE-TARGET-001) and is the relation fact of the statement; a relation declared as another kind than a table is reported ("%s" is not a table, PG-RELATION-KIND-001). The USING and WITH CHECK expressions are conditions (PG-TABLE-CONDITION-001) where the table is the only visible relation ("expressions ... can refer to columns of the table"). Source: https://www.postgresql.org/docs/17/sql-createpolicy.html. Status: Implemented.
Methods§
public function derive(
Relation $policy,
QualifiedName $table,
?Scalar $using,
?Scalar $check,
Derivation $derivation,
): voidResolves the table and derives the conditions.
Parameters
$policy | Relation | |
$table | QualifiedName | |
$using | ?Scalar | |
$check | ?Scalar | |
$derivation | Derivation |
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\AlterPolicy::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Policy/AlterPolicy.php:66
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\CreatePolicy::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Policy/CreatePolicy.php:74
Calls 12
- new Targets line 38
- method-call Derivation::target() line 39
- method-call Targets::resolve() line 39
- new RelationKinds line 40
- method-call RelationKinds::require() line 41
- method-call RelationKinds::of() line 41
- class-const RelationKind::BaseTable() line 41
- class-const KindRule::NotTable() line 41
- method-call Targets::scope() line 42
- method-call Targets::implicit() line 42
- method-call Conditions::derive() line 45
- new Conditions line 45
Writes TO, USING and WITH CHECK, each when given.
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\AlterPolicy::render() packages/sql-semantics-postgres/src/Statement/Table/Policy/AlterPolicy.php:84
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\CreatePolicy::render() packages/sql-semantics-postgres/src/Statement/Table/Policy/CreatePolicy.php:98
Calls 1
- method-call Output::keyword() line 58
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
PoliciesTestcalls
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\AlterPolicy::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Policy/AlterPolicy.php:66
- new SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\AlterPolicy::render() packages/sql-semantics-postgres/src/Statement/Table/Policy/AlterPolicy.php:84
- new SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\CreatePolicy::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Policy/CreatePolicy.php:74
- new SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\CreatePolicy::render() packages/sql-semantics-postgres/src/Statement/Table/Policy/CreatePolicy.php:98
Method calls 4
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\AlterPolicy::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Policy/AlterPolicy.php:66
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\AlterPolicy::render() packages/sql-semantics-postgres/src/Statement/Table/Policy/AlterPolicy.php:84
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\CreatePolicy::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/Policy/CreatePolicy.php:74
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\Policy\CreatePolicy::render() packages/sql-semantics-postgres/src/Statement/Table/Policy/CreatePolicy.php:98