Skip to content

Commit 2a59a68

Browse files
Merge pull request ClickHouse#56867 from kitaisreal/planner-support-transactions
Planner support transactions
2 parents 0eaf83b + b102c8e commit 2a59a68

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/Planner/Planner.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace
116116
void checkStoragesSupportTransactions(const PlannerContextPtr & planner_context)
117117
{
118118
const auto & query_context = planner_context->getQueryContext();
119-
if (query_context->getSettingsRef().throw_on_unsupported_query_inside_transaction)
119+
if (!query_context->getSettingsRef().throw_on_unsupported_query_inside_transaction)
120120
return;
121121

122122
if (!query_context->getCurrentTransaction())
@@ -130,13 +130,11 @@ void checkStoragesSupportTransactions(const PlannerContextPtr & planner_context)
130130
else if (auto * table_function_node = table_expression->as<TableFunctionNode>())
131131
storage = table_function_node->getStorage();
132132

133-
if (storage->supportsTransactions())
134-
continue;
135-
136-
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
137-
"Storage {} (table {}) does not support transactions",
138-
storage->getName(),
139-
storage->getStorageID().getNameForLogs());
133+
if (storage && !storage->supportsTransactions())
134+
throw Exception(ErrorCodes::NOT_IMPLEMENTED,
135+
"Storage {} (table {}) does not support transactions",
136+
storage->getName(),
137+
storage->getStorageID().getNameForLogs());
140138
}
141139
}
142140

@@ -1334,9 +1332,9 @@ void Planner::buildPlanForQueryNode()
13341332
query_node.getHaving() = {};
13351333
}
13361334

1337-
checkStoragesSupportTransactions(planner_context);
13381335
collectSets(query_tree, *planner_context);
13391336
collectTableExpressionData(query_tree, planner_context);
1337+
checkStoragesSupportTransactions(planner_context);
13401338

13411339
if (!select_query_options.only_analyze)
13421340
collectFiltersForAnalysis(query_tree, planner_context);

tests/analyzer_tech_debt.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
01064_incremental_streaming_from_2_src_with_feedback
66
01083_expressions_in_engine_arguments
77
01155_rename_move_materialized_view
8-
01173_transaction_control_queries
98
01214_test_storage_merge_aliases_with_where
109
01244_optimize_distributed_group_by_sharding_key
1110
01268_mv_scalars
@@ -26,7 +25,6 @@
2625
02139_MV_with_scalar_subquery
2726
02174_cte_scalar_cache_mv
2827
02302_s3_file_pruning
29-
02345_implicit_transaction
3028
02352_grouby_shadows_arg
3129
02354_annoy
3230
02428_parameterized_view

0 commit comments

Comments
 (0)