classMergeRule
final class MergeRule
Lowers MERGE.
Rule: PG-MERGE-LOWER-001. Scope: MergeStmt, merge_when_list, merge_when_clause, merge_when_tgt_matched, merge_when_tgt_not_matched, opt_merge_when_condition, merge_update, merge_delete, merge_insert, merge_values_clause. Constructors: Merge, MergeWhen with MergeMatch, MergeUpdate, MergeDelete, MergeInsert, MergeInsertDefaults, MergeNothing. PostgreSQL 16 writes the kind of a clause inside merge_when_clause; PostgreSQL 17 adds NOT MATCHED BY SOURCE, the optional BY TARGET and RETURNING. Termination: the clause list is flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-merge.html, https://www.postgresql.org/docs/16/sql-merge.html. Status: Implemented.
Methods§
Lowers MergeStmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 7
- static-call ImplementationGap::production() line 82
- new ChangeRule line 84
- method-call ChangeRule::target() line 86
- method-call Lowering::items() line 90
- method-call MergeRule::clause() line 91
- new Merge line 94
- method-call ChangeRule::returning() line 94
Lowers merge_when_clause.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 7
- class-const MergeRule::CLAUSES() line 105
- static-call ImplementationGap::production() line 105
- class-const MergeRule::KINDS() line 109
- new MergeWhen line 112
- method-call MergeRule::condition() line 112
- new MergeNothing line 112
- method-call MergeRule::action() line 112
Lowers opt_merge_when_condition; no condition is null.
Parameters
$condition | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 1
- static-call ImplementationGap::production() line 127
public function action(Node $action): MergeUpdate|MergeDelete|MergeInsert|MergeInsertDefaultsLowers merge_update, merge_delete or merge_insert.
Parameters
$action | Node |
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 11
- new InsertRule line 139
- new MergeUpdate line 142
- method-call ChangeRule::assignments() line 142
- new ChangeRule line 142
- new MergeDelete line 143
- new MergeInsert line 144
- method-call MergeRule::values() line 144
- method-call InsertRule::overriding() line 145
- method-call InsertRule::columns() line 146
- new MergeInsertDefaults line 152
- static-call ImplementationGap::production() line 153
public function values(Node $values): list<Scalar>Lowers merge_values_clause.
Parameters
$values | Node |
Returns
list<Scalar>Throws
ImplementationGap When the production has no ruleCalled from 4
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule::action() packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:144
- 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:150
Calls 1
- static-call ImplementationGap::production() line 168
Private surface 3§
Implementation details, listed for orientation only.
private const CLAUSES = ['merge_when_clause: WHEN MATCHED opt_merge_when_condition THEN merge_update' =…private const KINDS = ['merge_when_tgt_matched: WHEN MATCHED' => \SqlSemantics\Platform\PostgreSql\St…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
MergeRuleTestcalls