diff --git a/src/graph/validator/MatchValidator.cpp b/src/graph/validator/MatchValidator.cpp index 58233a35a08..eb5d998a374 100644 --- a/src/graph/validator/MatchValidator.cpp +++ b/src/graph/validator/MatchValidator.cpp @@ -97,9 +97,13 @@ Status MatchValidator::validateImpl() { NG_RETURN_IF_ERROR(validateFilter(withClause->where()->filter(), *whereClauseCtx)); withClauseCtx->where = std::move(whereClauseCtx); } - // A with pass all named aliases to the next query part. - aliasesAvailable = withClauseCtx->aliasesGenerated; + if (withClause->returnItems()->allNamedAliases()) { + aliasesAvailable.insert(withClauseCtx->aliasesGenerated.begin(), + withClauseCtx->aliasesGenerated.end()); + } else { + aliasesAvailable = withClauseCtx->aliasesGenerated; + } cypherCtx_->queryParts.back().boundary = std::move(withClauseCtx); cypherCtx_->queryParts.emplace_back(); cypherCtx_->queryParts.back().aliasesAvailable = aliasesAvailable; diff --git a/tests/tck/features/match/With.feature b/tests/tck/features/match/With.feature index 9f76a59e9b7..895853de8ba 100644 --- a/tests/tck/features/match/With.feature +++ b/tests/tck/features/match/With.feature @@ -374,3 +374,16 @@ Feature: With clause Then the result should be, in any order: | e.edgeProp_1_0 | | NULL | + + Scenario: with wildcard after unwind + When executing query: + """ + match p = (v0)-[e0]->(v1) where id(v0) in ["Tim Duncan"] unwind v0 as uv0 with * return e0 limit 5; + """ + Then the result should be, in any order: + | e0 | + | [:serve "Tim Duncan"->"Spurs" @0 {end_year: 2016, start_year: 1997}] | + | [:teammate "Tim Duncan"->"LaMarcus Aldridge" @0 {end_year: 2016, start_year: 2015}] | + | [:teammate "Tim Duncan"->"Tony Parker" @0 {end_year: 2016, start_year: 2001}] | + | [:like "Tim Duncan"->"Tony Parker" @0 {likeness: 95}] | + | [:teammate "Tim Duncan"->"Danny Green" @0 {end_year: 2016, start_year: 2010}] |