diff options
| author | Simon Riggs | 2018-04-12 10:22:56 +0000 |
|---|---|---|
| committer | Simon Riggs | 2018-04-12 10:22:56 +0000 |
| commit | 08ea7a2291db21a618d19d612c8060cda68f1892 (patch) | |
| tree | 4d10675439742c7206e089bd21e793332562ae83 /src/backend/nodes | |
| parent | c9c875a28fa6cbc38c227fb9e656dd7be948166f (diff) | |
Revert MERGE patch
This reverts commits d204ef63776b8a00ca220adec23979091564e465,
83454e3c2b28141c0db01c7d2027e01040df5249 and a few more commits thereafter
(complete list at the end) related to MERGE feature.
While the feature was fully functional, with sufficient test coverage and
necessary documentation, it was felt that some parts of the executor and
parse-analyzer can use a different design and it wasn't possible to do that in
the available time. So it was decided to revert the patch for PG11 and retry
again in the future.
Thanks again to all reviewers and bug reporters.
List of commits reverted, in reverse chronological order:
f1464c5380 Improve parse representation for MERGE
ddb4158579 MERGE syntax diagram correction
530e69e59b Allow cpluspluscheck to pass by renaming variable
01b88b4df5 MERGE minor errata
3af7b2b0d4 MERGE fix variable warning in non-assert builds
a5d86181ec MERGE INSERT allows only one VALUES clause
4b2d44031f MERGE post-commit review
4923550c20 Tab completion for MERGE
aa3faa3c7a WITH support in MERGE
83454e3c2b New files for MERGE
d204ef6377 MERGE SQL Command following SQL:2016
Author: Pavan Deolasee
Reviewed-by: Michael Paquier
Diffstat (limited to 'src/backend/nodes')
| -rw-r--r-- | src/backend/nodes/copyfuncs.c | 58 | ||||
| -rw-r--r-- | src/backend/nodes/equalfuncs.c | 49 | ||||
| -rw-r--r-- | src/backend/nodes/nodeFuncs.c | 64 | ||||
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 40 | ||||
| -rw-r--r-- | src/backend/nodes/readfuncs.c | 45 |
5 files changed, 3 insertions, 253 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index b856fe29b59..7c045a7afef 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -207,7 +207,6 @@ _copyModifyTable(const ModifyTable *from) COPY_NODE_FIELD(partitioned_rels); COPY_SCALAR_FIELD(partColsUpdated); COPY_NODE_FIELD(resultRelations); - COPY_SCALAR_FIELD(mergeTargetRelation); COPY_SCALAR_FIELD(resultRelIndex); COPY_SCALAR_FIELD(rootResultRelIndex); COPY_NODE_FIELD(plans); @@ -223,8 +222,6 @@ _copyModifyTable(const ModifyTable *from) COPY_NODE_FIELD(onConflictWhere); COPY_SCALAR_FIELD(exclRelRTI); COPY_NODE_FIELD(exclRelTlist); - COPY_NODE_FIELD(mergeSourceTargetList); - COPY_NODE_FIELD(mergeActionList); return newnode; } @@ -2137,20 +2134,6 @@ _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; -} - /* * _copyPartitionPruneStepOp */ @@ -3030,9 +3013,6 @@ _copyQuery(const Query *from) COPY_NODE_FIELD(setOperations); COPY_NODE_FIELD(constraintDeps); COPY_NODE_FIELD(withCheckOptions); - COPY_SCALAR_FIELD(mergeTarget_relation); - COPY_NODE_FIELD(mergeSourceTargetList); - COPY_NODE_FIELD(mergeActionList); COPY_LOCATION_FIELD(stmt_location); COPY_LOCATION_FIELD(stmt_len); @@ -3096,35 +3076,6 @@ _copyUpdateStmt(const UpdateStmt *from) return newnode; } -static MergeStmt * -_copyMergeStmt(const MergeStmt *from) -{ - MergeStmt *newnode = makeNode(MergeStmt); - - COPY_NODE_FIELD(relation); - COPY_NODE_FIELD(source_relation); - COPY_NODE_FIELD(join_condition); - COPY_NODE_FIELD(mergeWhenClauses); - COPY_NODE_FIELD(withClause); - - return newnode; -} - -static MergeWhenClause * -_copyMergeWhenClause(const MergeWhenClause *from) -{ - MergeWhenClause *newnode = makeNode(MergeWhenClause); - - COPY_SCALAR_FIELD(matched); - COPY_SCALAR_FIELD(commandType); - COPY_NODE_FIELD(condition); - COPY_NODE_FIELD(targetList); - COPY_NODE_FIELD(cols); - COPY_NODE_FIELD(values); - COPY_SCALAR_FIELD(override); - return newnode; -} - static SelectStmt * _copySelectStmt(const SelectStmt *from) { @@ -5110,9 +5061,6 @@ copyObjectImpl(const void *from) case T_OnConflictExpr: retval = _copyOnConflictExpr(from); break; - case T_MergeAction: - retval = _copyMergeAction(from); - break; case T_PartitionPruneStepOp: retval = _copyPartitionPruneStepOp(from); break; @@ -5197,12 +5145,6 @@ copyObjectImpl(const void *from) case T_UpdateStmt: retval = _copyUpdateStmt(from); break; - case T_MergeStmt: - retval = _copyMergeStmt(from); - break; - case T_MergeWhenClause: - retval = _copyMergeWhenClause(from); - break; case T_SelectStmt: retval = _copySelectStmt(from); break; diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 39946959afd..6a971d0141a 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -812,18 +812,6 @@ _equalOnConflictExpr(const OnConflictExpr *a, const OnConflictExpr *b) return true; } - -static bool -_equalMergeAction(const MergeAction *a, const MergeAction *b) -{ - COMPARE_SCALAR_FIELD(matched); - COMPARE_SCALAR_FIELD(commandType); - COMPARE_SCALAR_FIELD(override); - COMPARE_NODE_FIELD(qual); - COMPARE_NODE_FIELD(targetList); - - return true; -} /* * Stuff from relation.h */ @@ -989,8 +977,6 @@ _equalQuery(const Query *a, const Query *b) COMPARE_NODE_FIELD(setOperations); COMPARE_NODE_FIELD(constraintDeps); COMPARE_NODE_FIELD(withCheckOptions); - COMPARE_NODE_FIELD(mergeSourceTargetList); - COMPARE_NODE_FIELD(mergeActionList); COMPARE_LOCATION_FIELD(stmt_location); COMPARE_LOCATION_FIELD(stmt_len); @@ -1047,32 +1033,6 @@ _equalUpdateStmt(const UpdateStmt *a, const UpdateStmt *b) } static bool -_equalMergeStmt(const MergeStmt *a, const MergeStmt *b) -{ - COMPARE_NODE_FIELD(relation); - COMPARE_NODE_FIELD(source_relation); - COMPARE_NODE_FIELD(join_condition); - COMPARE_NODE_FIELD(mergeWhenClauses); - COMPARE_NODE_FIELD(withClause); - - return true; -} - -static bool -_equalMergeWhenClause(const MergeWhenClause *a, const MergeWhenClause *b) -{ - COMPARE_SCALAR_FIELD(matched); - COMPARE_SCALAR_FIELD(commandType); - COMPARE_NODE_FIELD(condition); - COMPARE_NODE_FIELD(targetList); - COMPARE_NODE_FIELD(cols); - COMPARE_NODE_FIELD(values); - COMPARE_SCALAR_FIELD(override); - - return true; -} - -static bool _equalSelectStmt(const SelectStmt *a, const SelectStmt *b) { COMPARE_NODE_FIELD(distinctClause); @@ -3197,9 +3157,6 @@ equal(const void *a, const void *b) case T_OnConflictExpr: retval = _equalOnConflictExpr(a, b); break; - case T_MergeAction: - retval = _equalMergeAction(a, b); - break; case T_JoinExpr: retval = _equalJoinExpr(a, b); break; @@ -3265,12 +3222,6 @@ equal(const void *a, const void *b) case T_UpdateStmt: retval = _equalUpdateStmt(a, b); break; - case T_MergeStmt: - retval = _equalMergeStmt(a, b); - break; - case T_MergeWhenClause: - retval = _equalMergeWhenClause(a, b); - break; case T_SelectStmt: retval = _equalSelectStmt(a, b); break; diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 4c309d236a3..a10014f755b 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -2146,16 +2146,6 @@ 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_PartitionPruneStepOp: { PartitionPruneStepOp *opstep = (PartitionPruneStepOp *) node; @@ -2276,10 +2266,6 @@ 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)) @@ -2957,18 +2943,6 @@ 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_PartitionPruneStepOp: { PartitionPruneStepOp *opstep = (PartitionPruneStepOp *) node; @@ -3134,8 +3108,6 @@ 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 *); @@ -3277,9 +3249,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/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. + * (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. */ bool raw_expression_tree_walker(Node *node, @@ -3459,36 +3431,6 @@ 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->mergeWhenClauses, context)) - return true; - if (walker(stmt->withClause, context)) - return true; - } - break; - case T_MergeWhenClause: - { - MergeWhenClause *mergeWhenClause = (MergeWhenClause *) node; - - if (walker(mergeWhenClause->condition, context)) - return true; - if (walker(mergeWhenClause->targetList, context)) - return true; - if (walker(mergeWhenClause->cols, context)) - return true; - if (walker(mergeWhenClause->values, context)) - return true; - } - break; case T_SelectStmt: { SelectStmt *stmt = (SelectStmt *) node; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index ef626b34b3d..3991a0ce83a 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -375,7 +375,6 @@ _outModifyTable(StringInfo str, const ModifyTable *node) WRITE_NODE_FIELD(partitioned_rels); WRITE_BOOL_FIELD(partColsUpdated); WRITE_NODE_FIELD(resultRelations); - WRITE_INT_FIELD(mergeTargetRelation); WRITE_INT_FIELD(resultRelIndex); WRITE_INT_FIELD(rootResultRelIndex); WRITE_NODE_FIELD(plans); @@ -391,22 +390,6 @@ _outModifyTable(StringInfo str, const ModifyTable *node) WRITE_NODE_FIELD(onConflictWhere); WRITE_UINT_FIELD(exclRelRTI); WRITE_NODE_FIELD(exclRelTlist); - WRITE_NODE_FIELD(mergeSourceTargetList); - WRITE_NODE_FIELD(mergeActionList); -} - -static void -_outMergeWhenClause(StringInfo str, const MergeWhenClause *node) -{ - WRITE_NODE_TYPE("MERGEWHENCLAUSE"); - - WRITE_BOOL_FIELD(matched); - WRITE_ENUM_FIELD(commandType, CmdType); - WRITE_NODE_FIELD(condition); - WRITE_NODE_FIELD(targetList); - WRITE_NODE_FIELD(cols); - WRITE_NODE_FIELD(values); - WRITE_ENUM_FIELD(override, OverridingKind); } static void @@ -1749,17 +1732,6 @@ _outOnConflictExpr(StringInfo str, const OnConflictExpr *node) } static void -_outMergeAction(StringInfo str, const MergeAction *node) -{ - WRITE_NODE_TYPE("MERGEACTION"); - - WRITE_BOOL_FIELD(matched); - WRITE_ENUM_FIELD(commandType, CmdType); - WRITE_NODE_FIELD(qual); - WRITE_NODE_FIELD(targetList); -} - -static void _outPartitionPruneInfo(StringInfo str, const PartitionPruneInfo *node) { int i; @@ -2189,7 +2161,6 @@ _outModifyTablePath(StringInfo str, const ModifyTablePath *node) WRITE_NODE_FIELD(partitioned_rels); WRITE_BOOL_FIELD(partColsUpdated); WRITE_NODE_FIELD(resultRelations); - WRITE_INT_FIELD(mergeTargetRelation); WRITE_NODE_FIELD(subpaths); WRITE_NODE_FIELD(subroots); WRITE_NODE_FIELD(withCheckOptionLists); @@ -2197,8 +2168,6 @@ _outModifyTablePath(StringInfo str, const ModifyTablePath *node) WRITE_NODE_FIELD(rowMarks); WRITE_NODE_FIELD(onconflict); WRITE_INT_FIELD(epqParam); - WRITE_NODE_FIELD(mergeSourceTargetList); - WRITE_NODE_FIELD(mergeActionList); } static void @@ -3012,9 +2981,6 @@ _outQuery(StringInfo str, const Query *node) WRITE_NODE_FIELD(setOperations); WRITE_NODE_FIELD(constraintDeps); /* withCheckOptions intentionally omitted, see comment in parsenodes.h */ - WRITE_INT_FIELD(mergeTarget_relation); - WRITE_NODE_FIELD(mergeSourceTargetList); - WRITE_NODE_FIELD(mergeActionList); WRITE_LOCATION_FIELD(stmt_location); WRITE_LOCATION_FIELD(stmt_len); } @@ -3733,9 +3699,6 @@ outNode(StringInfo str, const void *obj) case T_ModifyTable: _outModifyTable(str, obj); break; - case T_MergeWhenClause: - _outMergeWhenClause(str, obj); - break; case T_Append: _outAppend(str, obj); break; @@ -4012,9 +3975,6 @@ outNode(StringInfo str, const void *obj) case T_OnConflictExpr: _outOnConflictExpr(str, obj); break; - case T_MergeAction: - _outMergeAction(str, obj); - break; case T_PartitionPruneStepOp: _outPartitionPruneStepOp(str, obj); break; diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 93785e3bdfd..c466b98102e 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -270,9 +270,6 @@ _readQuery(void) READ_NODE_FIELD(setOperations); READ_NODE_FIELD(constraintDeps); /* withCheckOptions intentionally omitted, see comment in parsenodes.h */ - READ_INT_FIELD(mergeTarget_relation); - READ_NODE_FIELD(mergeSourceTargetList); - READ_NODE_FIELD(mergeActionList); READ_LOCATION_FIELD(stmt_location); READ_LOCATION_FIELD(stmt_len); @@ -1357,22 +1354,6 @@ _readPartitionPruneStepCombine(void) READ_DONE(); } -/* - * _readMergeAction - */ -static MergeAction * -_readMergeAction(void) -{ - READ_LOCALS(MergeAction); - - READ_BOOL_FIELD(matched); - READ_ENUM_FIELD(commandType, CmdType); - READ_NODE_FIELD(qual); - READ_NODE_FIELD(targetList); - - READ_DONE(); -} - static PartitionPruneInfo * _readPartitionPruneInfo(void) { @@ -1638,7 +1619,6 @@ _readModifyTable(void) READ_NODE_FIELD(partitioned_rels); READ_BOOL_FIELD(partColsUpdated); READ_NODE_FIELD(resultRelations); - READ_INT_FIELD(mergeTargetRelation); READ_INT_FIELD(resultRelIndex); READ_INT_FIELD(rootResultRelIndex); READ_NODE_FIELD(plans); @@ -1654,27 +1634,6 @@ _readModifyTable(void) READ_NODE_FIELD(onConflictWhere); READ_UINT_FIELD(exclRelRTI); READ_NODE_FIELD(exclRelTlist); - READ_NODE_FIELD(mergeSourceTargetList); - READ_NODE_FIELD(mergeActionList); - - READ_DONE(); -} - -/* - * _readMergeWhenClause - */ -static MergeWhenClause * -_readMergeWhenClause(void) -{ - READ_LOCALS(MergeWhenClause); - - READ_BOOL_FIELD(matched); - READ_ENUM_FIELD(commandType, CmdType); - READ_NODE_FIELD(condition); - READ_NODE_FIELD(targetList); - READ_NODE_FIELD(cols); - READ_NODE_FIELD(values); - READ_ENUM_FIELD(override, OverridingKind); READ_DONE(); } @@ -2657,8 +2616,6 @@ parseNodeString(void) return_value = _readFromExpr(); else if (MATCH("ONCONFLICTEXPR", 14)) return_value = _readOnConflictExpr(); - else if (MATCH("MERGEACTION", 11)) - return_value = _readMergeAction(); else if (MATCH("PARTITIONPRUNESTEPOP", 20)) return_value = _readPartitionPruneStepOp(); else if (MATCH("PARTITIONPRUNESTEPCOMBINE", 25)) @@ -2687,8 +2644,6 @@ parseNodeString(void) return_value = _readProjectSet(); else if (MATCH("MODIFYTABLE", 11)) return_value = _readModifyTable(); - else if (MATCH("MERGEWHENCLAUSE", 15)) - return_value = _readMergeWhenClause(); else if (MATCH("APPEND", 6)) return_value = _readAppend(); else if (MATCH("MERGEAPPEND", 11)) |
