diff --git a/tests/gql_behave/tests/memgraph_V1/features/memgraph_exists.feature b/tests/gql_behave/tests/memgraph_V1/features/memgraph_exists.feature index aef6940ce..3d30d1d60 100644 --- a/tests/gql_behave/tests/memgraph_V1/features/memgraph_exists.feature +++ b/tests/gql_behave/tests/memgraph_V1/features/memgraph_exists.feature @@ -357,22 +357,6 @@ Feature: WHERE exists """ Then the result should be empty - Scenario: Test node-only hop - Given an empty graph - And having executed: - """ - CREATE (:One {prop:1})-[:TYPE {prop: 1}]->(:Two {prop: 2})-[:TYPE {prop:2}]->(:Three {prop: 3}) - """ - When executing query: - """ - MATCH (n) WHERE exists((n)) RETURN n.prop; - """ - Then the result should be: - | n.prop | - | 1 | - | 2 | - | 3 | - Scenario: Test exists with different edge type Given an empty graph And having executed: diff --git a/tests/gql_behave/tests/memgraph_V1_on_disk/features/memgraph_exists.feature b/tests/gql_behave/tests/memgraph_V1_on_disk/features/memgraph_exists.feature index aef6940ce..3d30d1d60 100644 --- a/tests/gql_behave/tests/memgraph_V1_on_disk/features/memgraph_exists.feature +++ b/tests/gql_behave/tests/memgraph_V1_on_disk/features/memgraph_exists.feature @@ -357,22 +357,6 @@ Feature: WHERE exists """ Then the result should be empty - Scenario: Test node-only hop - Given an empty graph - And having executed: - """ - CREATE (:One {prop:1})-[:TYPE {prop: 1}]->(:Two {prop: 2})-[:TYPE {prop:2}]->(:Three {prop: 3}) - """ - When executing query: - """ - MATCH (n) WHERE exists((n)) RETURN n.prop; - """ - Then the result should be: - | n.prop | - | 1 | - | 2 | - | 3 | - Scenario: Test exists with different edge type Given an empty graph And having executed: diff --git a/tests/unit/cypher_main_visitor.cpp b/tests/unit/cypher_main_visitor.cpp index 63cca3aa4..c95e95452 100644 --- a/tests/unit/cypher_main_visitor.cpp +++ b/tests/unit/cypher_main_visitor.cpp @@ -4484,6 +4484,13 @@ TEST_P(CypherMainVisitorTest, ExistsThrow) { TestInvalidQueryWithMessage("MATCH (n) WHERE exists(p=(n)-[]->()) RETURN n;", ast_generator, "Identifiers are not supported in exists(...)."); + + TestInvalidQueryWithMessage("MATCH (n) WHERE exists() RETURN n;", ast_generator, + "EXISTS supports only a single relation as its input."); + TestInvalidQueryWithMessage("MATCH (n) WHERE exists((n)) RETURN n;", ast_generator, + "EXISTS supports only a single relation as its input."); + TestInvalidQueryWithMessage("MATCH (n) WHERE exists((n)-[]) RETURN n;", ast_generator, + "EXISTS supports only a single relation as its input."); } TEST_P(CypherMainVisitorTest, Exists) { @@ -4533,22 +4540,6 @@ TEST_P(CypherMainVisitorTest, Exists) { ASSERT_TRUE(edge2); ASSERT_TRUE(node3); } - - { - const auto *query = dynamic_cast(ast_generator.ParseQuery("MATCH (n) WHERE exists((n)) RETURN n;")); - const auto *match = dynamic_cast(query->single_query_->clauses_[0]); - - const auto *exists = dynamic_cast(match->where_->expression_); - - ASSERT_TRUE(exists); - - const auto pattern = exists->pattern_; - ASSERT_TRUE(pattern->atoms_.size() == 1); - - const auto *node = dynamic_cast(pattern->atoms_[0]); - - ASSERT_TRUE(node); - } } TEST_P(CypherMainVisitorTest, CallSubqueryThrow) {