Fix using path identifier after CREATE (#1629)

This commit is contained in:
DavIvek 2024-01-10 11:46:20 +01:00 committed by GitHub
parent 1ba2f4e619
commit d4bcdb77ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// Copyright 2023 Memgraph Ltd.
// Copyright 2024 Memgraph Ltd.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -380,6 +380,7 @@ class RuleBasedPlanner {
if (pattern.identifier_->user_declared_) {
std::vector<Symbol> path_elements;
for (const PatternAtom *atom : pattern.atoms_) path_elements.emplace_back(symbol_table.at(*atom->identifier_));
bound_symbols.insert(symbol_table.at(*pattern.identifier_));
last_op = std::make_unique<ConstructNamedPath>(std::move(last_op), symbol_table.at(*pattern.identifier_),
path_elements);
}

View File

@ -771,3 +771,17 @@ Feature: Match
Then the result should be:
| path |
| <(:label1 {id: 1})-[:type1 {id: 1}]->(:label2 {id: 2})-[:type1 {id: 2}]->(:label3 {id: 3})> |
Scenario: Using path indentifier from CREATE in MERGE
Given an empty graph
And having executed:
"""
CREATE p0=()-[:T0]->() MERGE ({k:(size(p0))});
"""
When executing query:
"""
MATCH (n {k: 1}) RETURN n;
"""
Then the result should be:
| n |
| ({k: 1}) |