1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Modified files for MERGE

This commit is contained in:
Simon Riggs
2018-04-02 21:12:47 +01:00
parent e6597dc353
commit 354f13855e
82 changed files with 2570 additions and 165 deletions

View File

@ -2146,6 +2146,16 @@ expression_tree_walker(Node *node,
return true;
}
break;
case T_MergeAction:
{
MergeAction *action = (MergeAction *) node;
if (walker(action->targetList, context))
return true;
if (walker(action->qual, context))
return true;
}
break;
case T_JoinExpr:
{
JoinExpr *join = (JoinExpr *) node;
@ -2255,6 +2265,10 @@ query_tree_walker(Query *query,
return true;
if (walker((Node *) query->onConflict, context))
return true;
if (walker((Node *) query->mergeSourceTargetList, context))
return true;
if (walker((Node *) query->mergeActionList, context))
return true;
if (walker((Node *) query->returningList, context))
return true;
if (walker((Node *) query->jointree, context))
@ -2932,6 +2946,18 @@ expression_tree_mutator(Node *node,
return (Node *) newnode;
}
break;
case T_MergeAction:
{
MergeAction *action = (MergeAction *) node;
MergeAction *newnode;
FLATCOPY(newnode, action, MergeAction);
MUTATE(newnode->qual, action->qual, Node *);
MUTATE(newnode->targetList, action->targetList, List *);
return (Node *) newnode;
}
break;
case T_JoinExpr:
{
JoinExpr *join = (JoinExpr *) node;
@ -3083,6 +3109,8 @@ query_tree_mutator(Query *query,
MUTATE(query->targetList, query->targetList, List *);
MUTATE(query->withCheckOptions, query->withCheckOptions, List *);
MUTATE(query->onConflict, query->onConflict, OnConflictExpr *);
MUTATE(query->mergeSourceTargetList, query->mergeSourceTargetList, List *);
MUTATE(query->mergeActionList, query->mergeActionList, List *);
MUTATE(query->returningList, query->returningList, List *);
MUTATE(query->jointree, query->jointree, FromExpr *);
MUTATE(query->setOperations, query->setOperations, Node *);
@ -3224,9 +3252,9 @@ query_or_expression_tree_mutator(Node *node,
* boundaries: we descend to everything that's possibly interesting.
*
* Currently, the node type coverage here extends only to DML statements
* (SELECT/INSERT/UPDATE/DELETE) and nodes that can appear in them, because
* this is used mainly during analysis of CTEs, and only DML statements can
* appear in CTEs.
* (SELECT/INSERT/UPDATE/DELETE/MERGE) and nodes that can appear in them,
* because this is used mainly during analysis of CTEs, and only DML
* statements can appear in CTEs.
*/
bool
raw_expression_tree_walker(Node *node,
@ -3406,6 +3434,20 @@ raw_expression_tree_walker(Node *node,
return true;
}
break;
case T_MergeStmt:
{
MergeStmt *stmt = (MergeStmt *) node;
if (walker(stmt->relation, context))
return true;
if (walker(stmt->source_relation, context))
return true;
if (walker(stmt->join_condition, context))
return true;
if (walker(stmt->mergeActionList, context))
return true;
}
break;
case T_SelectStmt:
{
SelectStmt *stmt = (SelectStmt *) node;