Skip to content

Commit 2817d41

Browse files
committed
Fix MERGE output when last clause
1 parent 6c3445d commit 2817d41

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/backend/parser/cypher_clause.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4924,7 +4924,24 @@ static Query *transform_cypher_merge(cypher_parsestate *cpstate, cypher_clause *
49244924

49254925
assign_query_collations(pstate, query);
49264926

4927-
return query;
4927+
if (clause->next)
4928+
return query;
4929+
{
4930+
Query *topquery;
4931+
cypher_parsestate *new_cpstate = make_cypher_parsestate(cpstate);
4932+
topquery = makeNode(Query);
4933+
topquery->commandType = CMD_SELECT;
4934+
topquery->targetList = NIL;
4935+
4936+
ParseState *pstate = (ParseState *) cpstate;
4937+
int rtindex;
4938+
4939+
ParseNamespaceItem *pnsi = transform_cypher_clause_as_subquery_2(new_cpstate, clause, NULL, false, query);
4940+
topquery->rtable = new_cpstate->pstate.p_rtable;
4941+
topquery->jointree = makeFromExpr(new_cpstate->pstate.p_joinlist, NULL);
4942+
4943+
return topquery;
4944+
}
49284945
}
49294946

49304947
/*

0 commit comments

Comments
 (0)