Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emotionbug committed Dec 15, 2022
1 parent 7d80568 commit 8299319
Showing 1 changed file with 7 additions and 37 deletions.
44 changes: 7 additions & 37 deletions src/backend/parser/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -3439,8 +3439,6 @@ transformCypherStmt(ParseState *pstate, CypherStmt *stmt)
CypherClause *clause;
NodeTag type;
bool valid = true;
NodeTag update_type = T_Invalid;
bool read = false;

clause = (CypherClause *) stmt->last;
type = cypherClauseTag(clause);
Expand All @@ -3454,7 +3452,6 @@ transformCypherStmt(ParseState *pstate, CypherStmt *stmt)
case T_CypherDeleteClause:
case T_CypherSetClause:
case T_CypherMergeClause:
update_type = type;
break;
default:
valid = false;
Expand All @@ -3473,7 +3470,13 @@ transformCypherStmt(ParseState *pstate, CypherStmt *stmt)
switch (type)
{
case T_CypherMatchClause:
read = true;
case T_CypherCreateClause:
case T_CypherDeleteClause:
case T_CypherSetClause:
case T_CypherMergeClause:
case T_CypherLoadClause:
case T_CypherUnwindClause:
/* do nothing. */
break;
case T_CypherProjection:
if (cypherProjectionKind(clause->detail) == CP_RETURN)
Expand All @@ -3482,39 +3485,6 @@ transformCypherStmt(ParseState *pstate, CypherStmt *stmt)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("RETURN must be at the end of the query")));
}
else
{
/* CP_WITH */
if (update_type != T_Invalid &&
update_type != T_CypherCreateClause)
read = true;
}
break;
case T_CypherCreateClause:
if (update_type == T_Invalid ||
update_type == T_CypherMergeClause)
{
update_type = T_CypherCreateClause;
}
/* todo: restriction is required? */
break;
case T_CypherDeleteClause:
case T_CypherSetClause:
/* todo: restriction is required? */
break;
case T_CypherMergeClause:
if (update_type == T_Invalid ||
update_type == T_CypherCreateClause)
{
update_type = T_CypherMergeClause;
}
/* todo: restriction is required? */
break;
case T_CypherLoadClause:
read = true;
break;
case T_CypherUnwindClause:
read = true;
break;
default:
elog(ERROR, "unrecognized Cypher clause type: %d", type);
Expand Down

0 comments on commit 8299319

Please sign in to comment.