diff --git a/src/Access/AccessControl.h b/src/Access/AccessControl.h index 904f77faf90..55ea4e4f717 100644 --- a/src/Access/AccessControl.h +++ b/src/Access/AccessControl.h @@ -164,7 +164,7 @@ public: int getBcryptWorkfactor() const; /// Enables logic that users without permissive row policies can still read rows using a SELECT query. - /// For example, if there two users A, B and a row policy is defined only for A, then + /// For example, if there are two users A, B and a row policy is defined only for A, then /// if this setting is true the user B will see all rows, and if this setting is false the user B will see no rows. void setEnabledUsersWithoutRowPoliciesCanReadRows(bool enable) { users_without_row_policies_can_read_rows = enable; } bool isEnabledUsersWithoutRowPoliciesCanReadRows() const { return users_without_row_policies_can_read_rows; } diff --git a/src/Planner/PlannerJoinTree.cpp b/src/Planner/PlannerJoinTree.cpp index afceab5f6c8..59da88f4e45 100644 --- a/src/Planner/PlannerJoinTree.cpp +++ b/src/Planner/PlannerJoinTree.cpp @@ -805,14 +805,19 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres prewhere_info->prewhere_actions = filter_info.actions; prewhere_info->prewhere_column_name = filter_info.column_name; prewhere_info->remove_prewhere_column = filter_info.do_remove_column; + prewhere_info->need_filter = true; } - else if (!table_expression_query_info.prewhere_info->row_level_filter) + else if (!prewhere_info->row_level_filter) { prewhere_info->row_level_filter = filter_info.actions; prewhere_info->row_level_column_name = filter_info.column_name; + prewhere_info->need_filter = true; + } + else + { + where_filters.emplace_back(filter_info, std::move(description)); } - prewhere_info->need_filter = true; } else {