Fix crash caused by using exists() in a RETURN statement (#1303)

This commit is contained in:
DavIvek 2023-10-09 11:31:49 +02:00 committed by GitHub
parent 2fd34489af
commit 3143c986de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -518,6 +518,10 @@ bool SymbolGenerator::PreVisit(Exists &exists) {
throw utils::NotYetImplemented("WITH can not be used with exists, but only during matching!");
}
if (scope.in_return) {
throw utils::NotYetImplemented("RETURN can not be used with exists, but only during matching!");
}
scope.in_exists = true;
const auto &symbol = CreateAnonymousSymbol();

View File

@ -527,3 +527,15 @@ Feature: WHERE exists
MATCH (n:Two) SET n.prop = exists((n)<-[:TYPE]-()) RETURN n.prop;
"""
Then an error should be raised
Scenario: Test exists does not work in RETURN clauses
Given an empty graph
And having executed:
"""
CREATE (:One {prop:1})-[:TYPE]->(:Two);
"""
When executing query:
"""
MATCH (n) RETURN exists((n)-[]-());
"""
Then an error should be raised