1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-07 00:36:50 +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:
Simon Riggs
2018-04-06 09:38:59 +01:00
parent 3b0b4f31f7
commit f1464c5380
11 changed files with 207 additions and 148 deletions

View File

@ -396,16 +396,17 @@ _outModifyTable(StringInfo str, const ModifyTable *node)
}
static void
_outMergeAction(StringInfo str, const MergeAction *node)
_outMergeWhenClause(StringInfo str, const MergeWhenClause *node)
{
WRITE_NODE_TYPE("MERGEACTION");
WRITE_NODE_TYPE("MERGEWHENCLAUSE");
WRITE_BOOL_FIELD(matched);
WRITE_ENUM_FIELD(commandType, CmdType);
WRITE_NODE_FIELD(condition);
WRITE_NODE_FIELD(qual);
WRITE_NODE_FIELD(stmt);
WRITE_NODE_FIELD(targetList);
WRITE_NODE_FIELD(cols);
WRITE_NODE_FIELD(values);
WRITE_ENUM_FIELD(override, OverridingKind);
}
static void
@ -1724,6 +1725,17 @@ _outOnConflictExpr(StringInfo str, const OnConflictExpr *node)
WRITE_NODE_FIELD(exclRelTlist);
}
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);
}
/*****************************************************************************
*
* Stuff from relation.h.
@ -3679,8 +3691,8 @@ outNode(StringInfo str, const void *obj)
case T_ModifyTable:
_outModifyTable(str, obj);
break;
case T_MergeAction:
_outMergeAction(str, obj);
case T_MergeWhenClause:
_outMergeWhenClause(str, obj);
break;
case T_Append:
_outAppend(str, obj);
@ -3958,6 +3970,9 @@ outNode(StringInfo str, const void *obj)
case T_OnConflictExpr:
_outOnConflictExpr(str, obj);
break;
case T_MergeAction:
_outMergeAction(str, obj);
break;
case T_Path:
_outPath(str, obj);
break;