8000 [3.7] Forbid subqueries in PRUNE in additional cases by goedderz · Pull Request #12586 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

[3.7] Forbid subqueries in PRUNE in additional cases #12586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to 8000
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix #12372
  • Loading branch information
goedderz committed Sep 1, 2020
commit 06b471d03a73eaaa6729cd934ec6b9fa053e2445
2 changes: 1 addition & 1 deletion arangod/Aql/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ reference:
auto subQuery = parser->ast()->createNodeLet(variableName.c_str(), variableName.size(), node, false);
parser->ast()->addOperation(subQuery);

$$ = parser->ast()->createNodeReference(variableName);
$$ = parser->ast()->createNodeSubqueryReference(variableName);
}
| reference '.' T_STRING %prec REFERENCE {
// named variable access, e.g. variable.reference
Expand Down
18 changes: 18 additions & 0 deletions tests/js/server/aql/aql-graph-traverser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,24 @@ function complexFilteringSuite() {
}
},

// Regression test for https://github.com/arangodb/arangodb/issues/12372
// While subqueries in PRUNE should have already been forbidden, there was
// a place in the grammar where the subquery wasn't correctly flagged.
testPruneWithSubquery2: function () {
// The additional parentheses in LENGTH are important for this test!
let query = `FOR v,e,p IN 1..100 OUTBOUND @start @ecol PRUNE 2 <= LENGTH((FOR w IN p.vertices FILTER w._id == v._id RETURN 1)) RETURN p`;
try {
let bindVars = {
'@eCol': en,
'start': vertex.Tri1
};
db._query(query, bindVars);
fail();
} catch (err) {
assertEqual(err.errorNum, errors.ERROR_QUERY_PARSE.code);
}
},

testVertexEarlyPruneHighDepth: function () {
var query = `WITH ${vn}
FOR v, e, p IN 100 OUTBOUND @start @@eCol
Expand Down
0