aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/copyfuncs.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2018-04-06 09:38:59 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2018-04-06 09:38:59 +0100
commitf1464c53804fa7280a7942f6ac08038440f73b11 (patch)
tree92667694010e18a435bd7d409b341d935a1ee90b /src/backend/nodes/copyfuncs.c
parent3b0b4f31f73a5f45f8e122d826211c13cd2412f7 (diff)
downloadpostgresql-f1464c53804fa7280a7942f6ac08038440f73b11.tar.gz
postgresql-f1464c53804fa7280a7942f6ac08038440f73b11.zip
Improve parse representation for MERGE
Separation of parser data structures from executor, as requested by Tom Lane. Further improvements possible. While there, implement error for multiple VALUES clauses via parser to allow line number of error, as requested by Andres Freund. Author: Pavan Deolasee Discussion: https://www.postgresql.org/message-id/CABOikdPpqjectFchg0FyTOpsGXyPoqwgC==OLKWuxgBOsrDDZw@mail.gmail.com
Diffstat (limited to 'src/backend/nodes/copyfuncs.c')
-rw-r--r--src/backend/nodes/copyfuncs.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index c3efca3c452..d2e4aa3c2f4 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -2136,6 +2136,20 @@ _copyOnConflictExpr(const OnConflictExpr *from)
return newnode;
}
+static MergeAction *
+_copyMergeAction(const MergeAction *from)
+{
+ MergeAction *newnode = makeNode(MergeAction);
+
+ COPY_SCALAR_FIELD(matched);
+ COPY_SCALAR_FIELD(commandType);
+ COPY_SCALAR_FIELD(override);
+ COPY_NODE_FIELD(qual);
+ COPY_NODE_FIELD(targetList);
+
+ return newnode;
+}
+
/* ****************************************************************
* relation.h copy functions
*
@@ -3054,24 +3068,24 @@ _copyMergeStmt(const MergeStmt *from)
COPY_NODE_FIELD(relation);
COPY_NODE_FIELD(source_relation);
COPY_NODE_FIELD(join_condition);
- COPY_NODE_FIELD(mergeActionList);
+ COPY_NODE_FIELD(mergeWhenClauses);
COPY_NODE_FIELD(withClause);
return newnode;
}
-static MergeAction *
-_copyMergeAction(const MergeAction *from)
+static MergeWhenClause *
+_copyMergeWhenClause(const MergeWhenClause *from)
{
- MergeAction *newnode = makeNode(MergeAction);
+ MergeWhenClause *newnode = makeNode(MergeWhenClause);
COPY_SCALAR_FIELD(matched);
COPY_SCALAR_FIELD(commandType);
COPY_NODE_FIELD(condition);
- COPY_NODE_FIELD(qual);
- COPY_NODE_FIELD(stmt);
COPY_NODE_FIELD(targetList);
-
+ COPY_NODE_FIELD(cols);
+ COPY_NODE_FIELD(values);
+ COPY_SCALAR_FIELD(override);
return newnode;
}
@@ -5059,6 +5073,9 @@ copyObjectImpl(const void *from)
case T_OnConflictExpr:
retval = _copyOnConflictExpr(from);
break;
+ case T_MergeAction:
+ retval = _copyMergeAction(from);
+ break;
/*
* RELATION NODES
@@ -5140,8 +5157,8 @@ copyObjectImpl(const void *from)
case T_MergeStmt:
retval = _copyMergeStmt(from);
break;
- case T_MergeAction:
- retval = _copyMergeAction(from);
+ case T_MergeWhenClause:
+ retval = _copyMergeWhenClause(from);
break;
case T_SelectStmt:
retval = _copySelectStmt(from);