mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
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
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user