classPseudoRelations
final class PseudoRelations
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.
Builds the scope where OLD and NEW stand for the old and new row of a table, as triggers and rules see them.
Rule: PG-OLD-NEW-001. OLD and NEW are two relations with the row shape of the table (system columns included). In a trigger's WHEN condition and a rule's WHERE condition both can be read by column name alone, so a name that is a column of the table is ambiguous unless qualified; in the actions of a rule they are reachable with a qualifier only. Source: https://www.postgresql.org/docs/17/sql-createtrigger.html, https://www.postgresql.org/docs/17/sql-createrule.html. Status: Implemented.
Methods§
public function scope(
Derivation $derivation,
Relation $relation,
RelationFact $fact,
bool $qualifiedOnly,
): EnvironmentAnswers the scope with OLD and NEW.
Parameters
$derivation | Derivation | |
$relation | Relation | The statement node that stands for the table |
$fact | RelationFact | |
$qualifiedOnly | bool | Whether OLD and NEW are reachable with a qualifier only |
Returns
Called from 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\RewriteRules::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/RewriteRules.php:52
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\RewriteRules::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/RewriteRules.php:54
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Triggers::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/Triggers.php:74
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Triggers::deriveConstraint() packages/sql-semantics-postgres/src/Rules/Table/Command/Triggers.php:93
Calls 7
- method-call Targets::implicit() line 38
- new Targets line 38
- new VisibleRelation line 41
- new Name line 41
- method-call Visibility::qualifiedOnly() line 42
- new Visibility line 42
- new Environment line 45
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
PseudoRelationsTestcalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\RewriteRules::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/RewriteRules.php:50
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Triggers::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/Triggers.php:74
- new SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Triggers::deriveConstraint() packages/sql-semantics-postgres/src/Rules/Table/Command/Triggers.php:93
Method calls 4
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\RewriteRules::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/RewriteRules.php:52
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\RewriteRules::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/RewriteRules.php:54
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Triggers::derive() packages/sql-semantics-postgres/src/Rules/Table/Command/Triggers.php:74
- method-call SqlSemantics\Platform\PostgreSql\Rules\Table\Command\Triggers::deriveConstraint() packages/sql-semantics-postgres/src/Rules/Table/Command/Triggers.php:93