Skip to content

Commit 4943ca5

Browse files
committed
Add CREATE GRAPH to Grammar
1 parent 2e70dc1 commit 4943ca5

File tree

5 files changed

+31024
-30991
lines changed

5 files changed

+31024
-30991
lines changed

src/backend/parser/cypher_analyze.c

+17-31
Original file line numberDiff line numberDiff line change
@@ -1399,20 +1399,8 @@ cypher_parse_analyze(RawStmt *parseTree, const char *sourceText,
13991399
if (numParams > 0)
14001400
parse_fixed_parameters(pstate, paramTypes, numParams);
14011401

1402-
pstate->p_queryEnv = queryEnv;
1403-
query = parse_analyze(parseTree, sourceText, paramTypes, numParams,
1404-
queryEnv);
1405-
1406-
return query;
1407-
//query = transformTopLevelStmt(pstate, parseTree);
1408-
if (list_length(parseTree->stmt) == 1 ) {
1409-
Node *n = linitial(parseTree->stmt);
1410-
1411-
1412-
1413-
if (is_ag_node(n, cypher_create_graph)) {
1414-
cypher_create_graph *ccg = n;
1415-
//ereport(ERROR, errmsg("Here"));
1402+
if (is_ag_node(parseTree->stmt, cypher_create_graph)) {
1403+
cypher_create_graph *ccg = parseTree->stmt;
14161404

14171405
query = cypher_create_graph_utility(pstate, ccg->graph_name);
14181406

@@ -1424,11 +1412,10 @@ cypher_parse_analyze(RawStmt *parseTree, const char *sourceText,
14241412
free_parsestate(pstate);
14251413

14261414
pgstat_report_query_id(query->queryId, false);
1427-
//PushActiveSnapshot(GetTransactionSnapshot());
14281415
return query;
14291416

1430-
} else if (is_ag_node(n, cypher_use_graph)) {
1431-
cypher_use_graph *ccg = n;
1417+
} else if (is_ag_node(parseTree->stmt, cypher_use_graph)) {
1418+
cypher_use_graph *ccg = parseTree->stmt;
14321419

14331420
query = cypher_use_graph_utility(pstate, ccg->graph_name);
14341421

@@ -1440,10 +1427,9 @@ cypher_parse_analyze(RawStmt *parseTree, const char *sourceText,
14401427
free_parsestate(pstate);
14411428

14421429
pgstat_report_query_id(query->queryId, false);
1443-
//PushActiveSnapshot(GetTransactionSnapshot());
14441430
return query;
1445-
} else if (is_ag_node(n, cypher_drop_graph)) {
1446-
cypher_drop_graph *ccg = n;
1431+
} else if (is_ag_node(parseTree->stmt, cypher_drop_graph)) {
1432+
cypher_drop_graph *ccg = parseTree->stmt;
14471433

14481434
query = cypher_drop_graph_utility(pstate, ccg->graph_name);
14491435

@@ -1455,22 +1441,21 @@ cypher_parse_analyze(RawStmt *parseTree, const char *sourceText,
14551441
free_parsestate(pstate);
14561442

14571443
pgstat_report_query_id(query->queryId, false);
1458-
//PushActiveSnapshot(GetTransactionSnapshot());
1459-
return query;
1460-
1461-
}
1462-
else if (!IsA(n, List)){
1463-
query = parse_analyze((makeRawStmt(n, 0)), sourceText, paramTypes, numParams,
1444+
return query;
1445+
}
1446+
1447+
pstate->p_queryEnv = queryEnv;
1448+
query = parse_analyze(parseTree, sourceText, paramTypes, numParams,
14641449
queryEnv);
14651450

1466-
return query;
1467-
}
1468-
}
1451+
return query;
1452+
//query = transformTopLevelStmt(pstate, parseTree);
1453+
/*
14691454
Oid graph_oid = get_session_graph_oid();
14701455
graph_cache_data *gcd = search_graph_namespace_cache(graph_oid);
14711456
1472-
cpstate->graph_name = gcd->name.data;
1473-
cpstate->graph_oid = graph_oid;
1457+
cpstate->graph_name = gcd->name.data;
1458+
cpstate->graph_oid = graph_oid;
14741459
14751460
query = analyze_cypher(parseTree->stmt, pstate, sourceText, 0, gcd->name.data, graph_oid, NULL);
14761461
//PushActiveSnapshot(GetTransactionSnapshot());
@@ -1485,6 +1470,7 @@ cpstate->graph_oid = graph_oid;
14851470
pgstat_report_query_id(query->queryId, false);
14861471
14871472
return query;
1473+
*/
14881474
}
14891475

14901476

0 commit comments

Comments
 (0)