From 7bff678cd93e50b2a0cc4ce7685af7db6377fc8a Mon Sep 17 00:00:00 2001
From: antonio2368 <antonio2368@users.noreply.github.com>
Date: Tue, 12 Jan 2021 19:10:32 +0100
Subject: [PATCH] Clear query executions if not in explicit transaction (#70)

---
 src/query/interpreter.cpp | 3 ---
 src/query/interpreter.hpp | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/query/interpreter.cpp b/src/query/interpreter.cpp
index ce638c96a..301c64f63 100644
--- a/src/query/interpreter.cpp
+++ b/src/query/interpreter.cpp
@@ -1175,9 +1175,6 @@ Interpreter::PrepareResult Interpreter::Prepare(
     const std::string &query_string,
     const std::map<std::string, storage::PropertyValue> &params) {
   if (!in_explicit_transaction_) {
-    // TODO(antonio2368): Should this throw?
-    CHECK(!ActiveQueryExecutions()) << "Only one active execution allowed "
-                                       "while not in explicit transaction!";
     query_executions_.clear();
   }
 
diff --git a/src/query/interpreter.hpp b/src/query/interpreter.hpp
index 920108707..cd0ed0d56 100644
--- a/src/query/interpreter.hpp
+++ b/src/query/interpreter.hpp
@@ -416,6 +416,9 @@ std::map<std::string, TypedValue> Interpreter::Pull(TStream *result_stream,
             break;
         }
         // As the transaction is done we can clear all the executions
+        // NOTE: we cannot clear query_execution inside the Abort and Commit
+        // methods as we will delete summary contained in them which we need
+        // after our query finished executing.
         query_executions_.clear();
       } else {
         // We can only clear this execution as some of the queries