classInsertRule
final class InsertRule
Lowers INSERT.
Rule: PG-INSERT-LOWER-001. Scope: InsertStmt, insert_target, insert_rest, override_kind, insert_column_list, insert_column_item, opt_on_conflict, opt_conf_expr. Constructors: InsertRows when the query is VALUES alone, in parentheses or none (the grammar keeps no node for them), InsertSelect for any other query, InsertDefaults for DEFAULT VALUES; TargetTable, ColumnTarget, Overriding, ConflictDoNothing, ConflictDoUpdate, IndexInference, ConstraintInference. Termination: lists are flattened iteratively; parentheses around VALUES are unwrapped one per level. Source: https://www.postgresql.org/docs/17/sql-insert.html. Status: Implemented.
Methods§
public function insert(Node $statement): InsertRows|InsertSelect|InsertDefaultsLowers InsertStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 10
- static-call ImplementationGap::production() line 62
- method-call InsertRule::target() line 65
- new InsertDefaults line 68
- method-call InsertRule::conflict() line 68
- method-call ChangeRule::returning() line 68
- new ChangeRule line 68
- method-call InsertRule::rest() line 70
- method-call InsertRule::rows() line 73
- new InsertRows line 75
- new InsertSelect line 78
public function rest(Form $rest): array{list<ColumnTarget>, Overriding|null, Query}Lowers the forms of insert_rest that hold a query: the column list, the override and the query.
Parameters
$rest | Form |
Returns
array{list<ColumnTarget>, Overriding|null, Query}Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 4
- method-call Form::node() line 91
- method-call InsertRule::overriding() line 92
- method-call InsertRule::columns() line 93
- static-call ImplementationGap::production() line 99
public function rows(Query $query): ValueRows|ParenthesizedRows|nullAnswers the VALUES rows a query is, when it is VALUES alone in parentheses or none; otherwise null.
Parameters
$query | Query |
Returns
Called from 1
Calls 2
public function target(Node $target): TargetTableLowers insert_target.
Parameters
$target | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 3
- new TargetTable line 134
- new RelationReference line 134
- static-call ImplementationGap::production() line 136
public function overriding(Node $kind): OverridingLowers override_kind.
Parameters
$kind | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::rest() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:92
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::rest() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:96
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:145
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:149
Calls 3
- class-const Overriding::User() line 150
- class-const Overriding::System() line 151
- static-call ImplementationGap::production() line 152
public function columns(Node $list): list<ColumnTarget>Lowers insert_column_list.
Parameters
$list | Node |
Returns
list<ColumnTarget>Throws
ImplementationGap When an item has no ruleCalled from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::rest() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:93
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::rest() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:95
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:146
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:148
Calls 3
- method-call Lowering::items() line 166
- static-call ImplementationGap::production() line 169
- new ColumnTarget line 171
public function conflict(Node $clause): ConflictDoNothing|ConflictDoUpdate|nullLowers opt_on_conflict; no clause is null.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::insert() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:68
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::insert() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:71
Calls 6
- new ConflictDoUpdate line 187
- method-call InsertRule::inference() line 188
- method-call ChangeRule::assignments() line 189
- new ChangeRule line 189
- new ConflictDoNothing line 192
- static-call ImplementationGap::production() line 194
public function inference(Node $target): IndexInference|ConstraintInference|nullLowers opt_conf_expr; no target is null.
Parameters
$target | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::conflict() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:188
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::conflict() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:192
Calls 3
- new IndexInference line 208
- new ConstraintInference line 209
- static-call ImplementationGap::production() line 211
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
InsertRuleTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\Manipulations::statement() packages/sql-semantics-postgres/src/Lowering/Manipulation/Manipulations.php:40
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:139
Method calls 5
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\Manipulations::statement() packages/sql-semantics-postgres/src/Lowering/Manipulation/Manipulations.php:40
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:145
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:146
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:148
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:149