@@ -1205,7 +1205,32 @@ cypher_parse_analyze(RawStmt *parseTree, const char *sourceText,
12051205
12061206 Node * n = parseTree -> stmt ;
12071207 // TODO: Cypher should be an ExtensibleNode, not a List
1208- if (IsA (n , List )) {
1208+
1209+ if (IsA (n , ExplainStmt )) {
1210+ ExplainStmt * explainStmt = n ;
1211+ if (IsA (explainStmt -> query , List )) {
1212+ cypher_parsestate * cpstate = pstate ;
1213+ Oid graph_oid = get_session_graph_oid ();
1214+ graph_cache_data * gcd = search_graph_namespace_cache (graph_oid );
1215+
1216+ cpstate -> graph_name = gcd -> name .data ;
1217+ cpstate -> graph_oid = graph_oid ;
1218+
1219+ explainStmt -> query = analyze_cypher (explainStmt -> query , pstate , sourceText , 0 , gcd -> name .data , graph_oid , NULL );
1220+ Query * result ;
1221+
1222+ /* transform contained query, allowing SELECT INTO */
1223+ //stmt->query = (Node *) transformOptionalSelectInto(pstate, stmt->query);
1224+
1225+ /* represent the command as a utility Query */
1226+ result = makeNode (Query );
1227+ result -> commandType = CMD_UTILITY ;
1228+ result -> utilityStmt = (Node * ) explainStmt ;
1229+ result -> querySource = QSRC_ORIGINAL ;
1230+ result -> canSetTag = true;
1231+ return result ;
1232+ }
1233+ } else if (IsA (n , List )) {
12091234 cypher_parsestate * cpstate = pstate ;
12101235 Oid graph_oid = get_session_graph_oid ();
12111236 graph_cache_data * gcd = search_graph_namespace_cache (graph_oid );
0 commit comments