Revert #24095. User-level settings will affect queries from view.

This commit is contained in:
Nikolai Kochetov 2021-08-05 17:17:22 +03:00
parent 3184902c68
commit fc12310ee8
3 changed files with 70 additions and 11 deletions

View File

@ -86,12 +86,7 @@ void StorageView::read(
current_inner_query = query_info.view_query->clone();
}
auto modified_context = Context::createCopy(context);
/// Use settings from global context,
/// because difference between settings set on VIEW creation and query execution can break queries
modified_context->setSettings(context->getGlobalContext()->getSettingsRef());
InterpreterSelectWithUnionQuery interpreter(current_inner_query, modified_context, {}, column_names);
InterpreterSelectWithUnionQuery interpreter(current_inner_query, context, {}, column_names);
interpreter.buildQueryPlan(query_plan);
/// It's expected that the columns read from storage are not constant.

View File

@ -1,8 +1,5 @@
join_use_nulls = 1
-
1 11 0
2 12 22
3 0 23
-
1 11 0
2 12 22
@ -12,9 +9,40 @@ join_use_nulls = 1
2 12 22
3 \N 23
-
1 11 0
1 11 \N
2 12 22
3 0 23
3 \N 23
join_use_nulls = 0
-
1 11 0
2 12 22
3 0 23
-
1 11 0
2 12 22
3 0 23
-
1 11 \N
2 12 22
3 \N 23
-
1 11 0
2 12 22
3 0 23
join_use_nulls = 1
-
-
1 11 0
2 12 22
3 0 23
-
1 11 \N
2 12 22
3 \N 23
-
1 11 \N
2 12 22
3 \N 23
join_use_nulls = 0
-
1 11 0

View File

@ -33,6 +33,19 @@ SET join_use_nulls = 1;
SELECT 'join_use_nulls = 1';
SELECT '-';
SELECT * FROM view_no_nulls; -- { serverError 349 }
SELECT '-';
SELECT * FROM view_no_nulls_set;
SELECT '-';
SELECT * FROM view_nulls_set;
SELECT '-';
SELECT * FROM view_nulls;
SET join_use_nulls = 0;
SELECT 'join_use_nulls = 0';
SELECT '-';
SELECT * FROM view_no_nulls;
SELECT '-';
@ -42,6 +55,29 @@ SELECT * FROM view_nulls_set;
SELECT '-';
SELECT * FROM view_nulls;
DETACH TABLE view_no_nulls;
DETACH TABLE view_no_nulls_set;
DETACH TABLE view_nulls_set;
DETACH TABLE view_nulls;
ATTACH TABLE view_no_nulls;
ATTACH TABLE view_no_nulls_set;
ATTACH TABLE view_nulls_set;
ATTACH TABLE view_nulls;
SET join_use_nulls = 1;
SELECT 'join_use_nulls = 1';
SELECT '-';
SELECT * FROM view_no_nulls; -- { serverError 349 }
SELECT '-';
SELECT * FROM view_no_nulls_set;
SELECT '-';
SELECT * FROM view_nulls_set;
SELECT '-';
SELECT * FROM view_nulls;
SET join_use_nulls = 0;
SELECT 'join_use_nulls = 0';