classAlterPolicy
final class AlterPolicy
implements Statement, Relation
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to change the roles or conditions of a row security policy.
Mirrors PostgreSQL's AlterPolicyStmt. The table is resolved and is the relation fact of the statement; the conditions are derived as in CREATE POLICY (PG-POLICY-001). Source: https://www.postgresql.org/docs/17/sql-alterpolicy.html.
$statement = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('ALTER POLICY p ON t TO PUBLIC USING (true)');
$statement->toString() // => 'ALTER POLICY p ON t TO public USING (TRUE)'Properties§
public list<RoleSpec> $rolespublic Name $namepublic QualifiedName $tablepublic Scalar|null $using = nullpublic Scalar|null $check = nullMethods§
public function __construct(
public Name $name,
public QualifiedName $table,
list<RoleSpec> $roles = [],
public Scalar|null $using = null,
public Scalar|null $check = null,
)Parameters
$name | Name | The policy name |
$table | QualifiedName | The table |
$roles | list<RoleSpec> | The new roles; none keeps them |
$using | Scalar|null | The new USING condition |
$check | Scalar|null | The new WITH CHECK condition |
Calls 2
- static-call Check::listOf() line 58
- class-const RoleSpec::class() line 58
public function deriveStatement(Derivation $derivation): voidResolves the table and derives the conditions.
Parameters
$derivation | Derivation |
Calls 2
- method-call Policies::derive() line 66
- new Policies line 66
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactResolves the table and answers its facts.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 2
- method-call Targets::resolve() line 74
- new Targets line 74
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 5
- method-call Output::keyword() line 82
- method-call Spelling::qualified() line 83
- new Spelling line 83
- method-call Policies::write() line 84
- new Policies line 84
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.