Throw when exists() combined with CASE (#1382)

This commit is contained in:
Andi 2023-11-02 08:25:34 +01:00 committed by GitHub
parent 157b36162b
commit 4aacd45640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 0 deletions

View File

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

View File

@ -97,3 +97,15 @@ Feature: Case
Then the result should be:
| CASE name WHEN null THEN "doesn't work" WHEN 2 THEN "doesn't work" ELSE 'works' END |
| 'works' |
Scenario: Test exists does not work in CASE clauses
Given an empty graph
And having executed:
"""
CREATE ()-[:T]->();
"""
When executing query:
"""
MATCH (a) WHERE CASE WHEN TRUE THEN exists(()-[]->()) END RETURN a;
"""
Then an error should be raised

View File

@ -97,3 +97,15 @@ Feature: Case
Then the result should be:
| CASE name WHEN null THEN "doesn't work" WHEN 2 THEN "doesn't work" ELSE 'works' END |
| 'works' |
Scenario: Test exists does not work in CASE clauses
Given an empty graph
And having executed:
"""
CREATE ()-[:T]->();
"""
When executing query:
"""
MATCH (a) WHERE CASE WHEN TRUE THEN exists(()-[]->()) END RETURN a;
"""
Then an error should be raised