mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.
This allows MERGE commands to include WHEN NOT MATCHED BY SOURCE actions, which operate on rows that exist in the target relation, but not in the data source. These actions can execute UPDATE, DELETE, or DO NOTHING sub-commands. This is in contrast to already-supported WHEN NOT MATCHED actions, which operate on rows that exist in the data source, but not in the target relation. To make this distinction clearer, such actions may now be written as WHEN NOT MATCHED BY TARGET. Writing WHEN NOT MATCHED without specifying BY SOURCE or BY TARGET is equivalent to writing WHEN NOT MATCHED BY TARGET. Dean Rasheed, reviewed by Alvaro Herrera, Ted Yu and Vik Fearing. Discussion: https://postgr.es/m/CAEZATCWqnKGc57Y_JanUBHQXNKcXd7r=0R4NEZUVwP+syRkWbA@mail.gmail.com
This commit is contained in:
@@ -3716,6 +3716,7 @@ create_lockrows_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
* 'onconflict' is the ON CONFLICT clause, or NULL
|
||||
* 'epqParam' is the ID of Param for EvalPlanQual re-eval
|
||||
* 'mergeActionLists' is a list of lists of MERGE actions (one per rel)
|
||||
* 'mergeJoinConditions' is a list of join conditions for MERGE (one per rel)
|
||||
*/
|
||||
ModifyTablePath *
|
||||
create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
@@ -3727,7 +3728,8 @@ create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
List *updateColnosLists,
|
||||
List *withCheckOptionLists, List *returningLists,
|
||||
List *rowMarks, OnConflictExpr *onconflict,
|
||||
List *mergeActionLists, int epqParam)
|
||||
List *mergeActionLists, List *mergeJoinConditions,
|
||||
int epqParam)
|
||||
{
|
||||
ModifyTablePath *pathnode = makeNode(ModifyTablePath);
|
||||
|
||||
@@ -3795,6 +3797,7 @@ create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
pathnode->onconflict = onconflict;
|
||||
pathnode->epqParam = epqParam;
|
||||
pathnode->mergeActionLists = mergeActionLists;
|
||||
pathnode->mergeJoinConditions = mergeJoinConditions;
|
||||
|
||||
return pathnode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user