dbms: fixed error with max_subquery_depth and GLOBAL subqueries [#METR-19569].

This commit is contained in:
Alexey Milovidov 2015-12-25 04:37:17 +03:00
parent f1f3619df4
commit ce70e528e0
3 changed files with 8 additions and 1 deletions

View File

@ -333,7 +333,7 @@ void ExpressionAnalyzer::addExternalStorage(ASTPtr & subquery_or_table_name)
external_table_name = "_data" + toString(external_table_id);
}
SharedPtr<InterpreterSelectQuery> interpreter = interpretSubquery(subquery_or_table_name, context, subquery_depth + 1, {});
SharedPtr<InterpreterSelectQuery> interpreter = interpretSubquery(subquery_or_table_name, context, subquery_depth, {});
Block sample = interpreter->getSampleBlock();
NamesAndTypesListPtr columns = new NamesAndTypesList(sample.getColumnsList());

View File

@ -0,0 +1,3 @@
1
1
2

View File

@ -0,0 +1,4 @@
SET max_subquery_depth = 3;
SELECT 1 FROM remote('127.0.0.{1,2}', system.one) WHERE 1 GLOBAL IN (SELECT 1 FROM remote('127.0.0.{1,2}', system.one) WHERE 1 GLOBAL IN (SELECT 1 FROM remote('127.0.0.{1,2}', system.one) WHERE 1 GLOBAL IN (SELECT 1 FROM remote('127.0.0.{1,2}', system.one))));
SELECT 2 FROM system.one WHERE 1 IN (SELECT 1 FROM system.one WHERE 1 IN (SELECT 1 FROM system.one WHERE 1 IN (SELECT 1 FROM system.one)));