From 5012824e053a882ab5e020ba4ef7ff0abc029a7c Mon Sep 17 00:00:00 2001
From: jbajic <jure.bajic@memgraph.com>
Date: Thu, 4 Aug 2022 11:45:16 +0200
Subject: [PATCH] Address review comments

---
 src/query/v2/metadata.cpp      | 4 ----
 src/query/v2/metadata.hpp      | 2 --
 src/query/v2/plan/operator.cpp | 6 ++++--
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/query/v2/metadata.cpp b/src/query/v2/metadata.cpp
index 7735edacf..f8a14d4a0 100644
--- a/src/query/v2/metadata.cpp
+++ b/src/query/v2/metadata.cpp
@@ -72,10 +72,6 @@ constexpr std::string_view GetCodeString(const NotificationCode code) {
       return "ReplicaPortWarning"sv;
     case NotificationCode::SET_REPLICA:
       return "SetReplica"sv;
-    case NotificationCode::SHOW_SCHEMA:
-      return "ShowSchema"sv;
-    case NotificationCode::SHOW_SCHEMAS:
-      return "ShowSchemas"sv;
     case NotificationCode::START_STREAM:
       return "StartStream"sv;
     case NotificationCode::START_ALL_STREAMS:
diff --git a/src/query/v2/metadata.hpp b/src/query/v2/metadata.hpp
index 4a5e7b9c9..c5211b1c1 100644
--- a/src/query/v2/metadata.hpp
+++ b/src/query/v2/metadata.hpp
@@ -44,8 +44,6 @@ enum class NotificationCode : uint8_t {
   REPLICA_PORT_WARNING,
   REGISTER_REPLICA,
   SET_REPLICA,
-  SHOW_SCHEMA,
-  SHOW_SCHEMAS,
   START_STREAM,
   START_ALL_STREAMS,
   STOP_STREAM,
diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp
index 432a8c7e8..4e3005d75 100644
--- a/src/query/v2/plan/operator.cpp
+++ b/src/query/v2/plan/operator.cpp
@@ -198,8 +198,10 @@ VertexAccessor &CreateLocalVertexAtomically(const NodeCreationInfo &node_info, F
       properties.emplace_back(property_id, value);
     }
   }
-  // TODO Remove later on since that will be enforced from grammar side
-  MG_ASSERT(!node_info.labels.empty(), "There must be at least one label!");
+
+  if (node_info.labels.empty()) {
+    throw QueryRuntimeException("Primary label must be defined!");
+  }
   const auto primary_label = node_info.labels[0];
   std::vector<storage::v3::LabelId> secondary_labels(node_info.labels.begin() + 1, node_info.labels.end());
   auto maybe_new_node = dba.InsertVertexAndValidate(primary_label, secondary_labels, properties);