classConstraintRule
final class ConstraintRule
Lowers table constraints, constraint attributes and foreign-key clauses.
Rule: PG-CONSTRAINT-LOWER-001. Scope: TableConstraint, ConstraintElem, opt_c_include, ExclusionConstraintList, ExclusionConstraintElem, OptConsTableSpace, ExistingIndex, ConstraintAttributeSpec, ConstraintAttributeElem, key_match, key_actions, key_update, key_delete, key_action. A constraint name is kept on its constraint; attributes and referential actions keep the order written. Termination: lists are flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-createtable.html. Status: Implemented.
Methods§
public function tableConstraint(Node $constraint): ConstraintLowers TableConstraint.
Parameters
$constraint | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call ConstraintRule::element() line 85
- static-call ImplementationGap::production() line 87
public function element(Form $form, ?Name $name): ConstraintLowers ConstraintElem with its name.
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::tableConstraint() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:85
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::tableConstraint() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:86
Calls 18
- new TableCheck line 102
- method-call Form::node() line 102
- method-call ConstraintRule::attributes() line 102
- new TableUnique line 103
- method-call ConstraintRule::included() line 106
- method-call ConstraintRule::tablespace() line 108
- new IndexConstraint line 112
- method-call ConstraintRule::index() line 112
- new TablePrimaryKey line 113
- new Exclusion line 122
- method-call ConstraintRule::exclusions() line 123
- method-call IndexRule::method() line 124
- new IndexRule line 124
- method-call IndexRule::predicate() line 128
- new ForeignKey line 132
- method-call ConstraintRule::match() line 136
- method-call ConstraintRule::actions() line 137
- static-call ImplementationGap::production() line 141
Lowers opt_c_include.
Parameters
$clause | Node |
Returns
list<Name>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 3
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:106
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:115
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:125
Calls 1
- static-call ImplementationGap::production() line 159
public function exclusions(Node $list): list<ExclusionElement>Lowers ExclusionConstraintList.
Parameters
$list | Node |
Returns
list<ExclusionElement>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 5
- new IndexRule line 173
- method-call Lowering::items() line 174
- new ExclusionElement line 177
- method-call IndexRule::element() line 177
- static-call ImplementationGap::production() line 179
Lowers OptConsTableSpace; none is null.
Parameters
$clause | Node |
Returns
?NameThrows
ImplementationGap When the production has no ruleTest cases 1
Called from 5
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:252
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:255
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:108
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:117
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:127
Calls 1
- static-call ImplementationGap::production() line 198
Lowers ExistingIndex.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:112
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:121
Calls 1
- static-call ImplementationGap::production() line 211
public function attributes(Node $list): list<ConstraintAttribute>Lowers ConstraintAttributeSpec.
Parameters
$list | Node |
Returns
list<ConstraintAttribute>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 8
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:102
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:109
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:112
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:118
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:121
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:129
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:138
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::constraintAttributes() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:117
Calls 3
- method-call Lowering::items() line 227
- class-const ConstraintRule::ATTRIBUTES() line 229
- static-call ImplementationGap::production() line 229
Lowers key_match; none is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:263
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:136
Calls 2
- class-const ConstraintRule::MATCH() line 247
- static-call ImplementationGap::production() line 247
public function actions(Node $clause): list<ReferentialAction>Lowers key_actions with its key_update and key_delete.
Parameters
$clause | Node |
Returns
list<ReferentialAction>Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:264
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::element() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:137
Calls 5
- method-call ConstraintRule::action() line 267
- class-const ReferenceEvent::Update() line 267
- class-const ReferenceEvent::Delete() line 268
- static-call ImplementationGap::production() line 269
- function-call
in_arrayline 273
public function action(ReferenceEvent $event, Node $action): ReferentialActionLowers key_action for an event.
Parameters
$event | ReferenceEvent | |
$action | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::actions() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:267
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ConstraintRule::actions() packages/sql-semantics-postgres/src/Lowering/Table/ConstraintRule.php:268
Calls 3
- class-const ConstraintRule::ACTIONS() line 288
- static-call ImplementationGap::production() line 288
- new ReferentialAction line 290
Private surface 4§
Implementation details, listed for orientation only.
private const ATTRIBUTES = ['ConstraintAttributeElem: NOT DEFERRABLE' => \SqlSemantics\Platform\PostgreSql…private const MATCH = ['key_match: MATCH FULL' => \SqlSemantics\Platform\PostgreSql\Statement\Constra…private const ACTIONS = ['key_action: NO ACTION' => \SqlSemantics\Platform\PostgreSql\Statement\Constra…private Lowering $loweringTest cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
ConstraintRuleTest::testActionLowersTheColumnsOfSetNullcallsConstraintRuleTest::testActionsKeepsTheOrdercallsConstraintRuleTest::testAttributesKeepsTheOrdercallsConstraintRuleTest::testElementLowersAForeignKeycallsConstraintRuleTest::testExclusionsLowersTheOperatorscallsConstraintRuleTest::testIncludedLowersTheColumnscallsConstraintRuleTest::testIndexLowersTheExistingIndexcallsConstraintRuleTest::testMatchIsNullWhenNotWrittencallsConstraintRuleTest::testTableConstraintKeepsTheNamecallsConstraintRuleTest::testTablespaceLowersTheIndexTablespacecalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:243
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::tableConstraint() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:105
- new SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::constraintAttributes() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:117
Method calls 6
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:252
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:255
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:263
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\ColumnRule::constraint() packages/sql-semantics-postgres/src/Lowering/Table/ColumnRule.php:264
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::tableConstraint() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:105
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Table\Tables::constraintAttributes() packages/sql-semantics-postgres/src/Lowering/Table/Tables.php:117