|
6 | 6 | #include <AggregateFunctions/AggregateFunctionFactory.h> |
7 | 7 | #include <Columns/ColumnNullable.h> |
8 | 8 | #include <Core/Settings.h> |
| 9 | +#include <Core/ServerSettings.h> |
9 | 10 | #include <Processors/Transforms/buildPushingToViewsChain.h> |
10 | 11 | #include <DataTypes/DataTypeNullable.h> |
11 | 12 | #include <Interpreters/DatabaseCatalog.h> |
@@ -411,10 +412,6 @@ std::pair<std::vector<Chain>, std::vector<Chain>> InterpreterInsertQuery::buildP |
411 | 412 | if (!running_group) |
412 | 413 | running_group = std::make_shared<ThreadGroup>(getContext()); |
413 | 414 |
|
414 | | - if (getContext()->getServerSettings().disable_insertion_and_mutation |
415 | | - && query.table_id.database_name != DatabaseCatalog::SYSTEM_DATABASE) |
416 | | - throw Exception(ErrorCodes::QUERY_IS_PROHIBITED, "Insert queries are prohibited"); |
417 | | - |
418 | 415 | std::vector<Chain> sink_chains; |
419 | 416 | std::vector<Chain> presink_chains; |
420 | 417 |
|
@@ -737,6 +734,9 @@ BlockIO InterpreterInsertQuery::execute() |
737 | 734 | const Settings & settings = getContext()->getSettingsRef(); |
738 | 735 | auto & query = query_ptr->as<ASTInsertQuery &>(); |
739 | 736 |
|
| 737 | + if (getContext()->getServerSettings().disable_insertion_and_mutation |
| 738 | + && query.table_id.database_name != DatabaseCatalog::SYSTEM_DATABASE) |
| 739 | + throw Exception(ErrorCodes::QUERY_IS_PROHIBITED, "Insert queries are prohibited"); |
740 | 740 |
|
741 | 741 | StoragePtr table = getTable(query); |
742 | 742 | checkStorageSupportsTransactionsIfNeeded(table, getContext()); |
|
0 commit comments