Fix a crash caused by declaring a path with only one node in OPTIONAL MATCH clause (#1318)

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

View File

@ -488,6 +488,10 @@ class RuleBasedPlanner {
last_op = std::make_unique<ScanAll>(std::move(last_op), node1_symbol, view);
new_symbols.emplace_back(node1_symbol);
last_op = GenFilters(std::move(last_op), bound_symbols, filters, storage, symbol_table);
last_op = impl::GenNamedPaths(std::move(last_op), bound_symbols, named_paths);
last_op = GenFilters(std::move(last_op), bound_symbols, filters, storage, symbol_table);
} else if (named_paths.size() == 1U) {
last_op = GenFilters(std::move(last_op), bound_symbols, filters, storage, symbol_table);
last_op = impl::GenNamedPaths(std::move(last_op), bound_symbols, named_paths);
last_op = GenFilters(std::move(last_op), bound_symbols, filters, storage, symbol_table);

View File

@ -323,3 +323,16 @@ Feature: OptionalMatchAcceptance
| a | b |
| [] | [42, 43, 44] |
And no side effects
Scenario: Declaring a path with only one node in OPTIONAL MATCH after MATCH in which that node is already used
When executing query:
"""
MATCH (n1) OPTIONAL MATCH p=(n1) RETURN p;
"""
Then the result should be:
| p |
| <(:Single)> |
| <(:A {prop: 42})> |
| <(:B {prop: 46})> |
| <(:C)> |
And no side effects