classRewriteRules
final class RewriteRules
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.
Derives and writes CREATE RULE.
Rule: PG-REWRITE-RULE-001. The table is resolved (PG-TABLE-TARGET-001) and is the relation fact of the statement; a materialized view, a foreign table or a sequence cannot have rules (PG-RELATION-KIND-001). The WHERE condition sees OLD and NEW (PG-OLD-NEW-001). Each action is derived as a statement whose enclosing scope holds OLD and NEW, reachable with a qualifier only ("Within
- condition and command, the special table names NEW and OLD can be used to
- refer to values in the referenced table"); a NOTIFY action has no
expression. Source: https://www.postgresql.org/docs/17/sql-createrule.html. Termination: one pass over the actions. Status: Implemented.
Methods§
public function derive(CreateRule $rule, Derivation $derivation): voidResolves the table and derives the condition and the actions.
Parameters
$rule | CreateRule | |
$derivation | Derivation |
Called from 1
Calls 19
- method-call Derivation::target() line 42
- method-call Targets::resolve() line 42
- new Targets line 42
- new RelationKinds line 43
- method-call RelationKinds::of() line 44
- class-const RelationKind::MaterializedView() line 45
- method-call Derivation::report() line 46
- new KindProblem line 46
- class-const KindRule::RulesOnMaterializedView() line 46
- method-call RelationKinds::require() line 48
- class-const RelationKind::BaseTable() line 48
- class-const RelationKind::View() line 48
- class-const KindRule::RulesOnRelation() line 48
- new PseudoRelations line 50
- method-call Conditions::derive() line 52
- new Conditions line 52
- method-call PseudoRelations::scope() line 52
- method-call Derivation::query() line 57
- method-call Derivation::member() line 59
public function write(Output $out, CreateRule $rule): voidWrites CREATE RULE.
Parameters
$out | Output | |
$rule | CreateRule |
Called from 1
Calls 5
- method-call Output::keyword() line 69
- method-call Spelling::qualified() line 74
- new Spelling line 74
- method-call Output::symbol() line 83
- method-call Output::list() line 87
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
RewriteRulesTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Statement\Table\View\CreateRule::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/View/CreateRule.php:73
- new SqlSemantics\Platform\PostgreSql\Statement\Table\View\CreateRule::render() packages/sql-semantics-postgres/src/Statement/Table/View/CreateRule.php:89
Method calls 2
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\View\CreateRule::deriveStatement() packages/sql-semantics-postgres/src/Statement/Table/View/CreateRule.php:73
- method-call SqlSemantics\Platform\PostgreSql\Statement\Table\View\CreateRule::render() packages/sql-semantics-postgres/src/Statement/Table/View/CreateRule.php:89