Fix formatting in InterpreterCreateQuery.cpp

This commit is contained in:
Vitaly Baranov 2024-11-30 12:43:38 +01:00 committed by GitHub
parent dc4bbc8d73
commit 9554d355b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1633,29 +1633,29 @@ BlockIO InterpreterCreateQuery::createTable(ASTCreateQuery & create)
if (isReplicated(*inner_table_engine)) if (isReplicated(*inner_table_engine))
is_storage_replicated = true; is_storage_replicated = true;
} }
} }
bool allow_heavy_populate = getContext()->getSettingsRef()[Setting::database_replicated_allow_heavy_create] && create.is_populate; bool allow_heavy_populate = getContext()->getSettingsRef()[Setting::database_replicated_allow_heavy_create] && create.is_populate;
if (!allow_heavy_populate && database && database->getEngineName() == "Replicated" && (create.select || create.is_populate)) if (!allow_heavy_populate && database && database->getEngineName() == "Replicated" && (create.select || create.is_populate))
{
const bool allow_create_select_for_replicated
= (create.isView() && !create.is_populate) || create.is_create_empty || !is_storage_replicated;
if (!allow_create_select_for_replicated)
{ {
const bool allow_create_select_for_replicated /// POPULATE can be enabled with setting, provide hint in error message
= (create.isView() && !create.is_populate) || create.is_create_empty || !is_storage_replicated; if (create.is_populate)
if (!allow_create_select_for_replicated)
{
/// POPULATE can be enabled with setting, provide hint in error message
if (create.is_populate)
throw Exception(
ErrorCodes::SUPPORT_IS_DISABLED,
"CREATE with POPULATE is not supported with Replicated databases. Consider using separate CREATE and INSERT "
"queries. "
"Alternatively, you can enable 'database_replicated_allow_heavy_create' setting to allow this operation, use with "
"caution");
throw Exception( throw Exception(
ErrorCodes::SUPPORT_IS_DISABLED, ErrorCodes::SUPPORT_IS_DISABLED,
"CREATE AS SELECT is not supported with Replicated databases. Consider using separate CREATE and INSERT queries."); "CREATE with POPULATE is not supported with Replicated databases. Consider using separate CREATE and INSERT "
} "queries. "
"Alternatively, you can enable 'database_replicated_allow_heavy_create' setting to allow this operation, use with "
"caution");
throw Exception(
ErrorCodes::SUPPORT_IS_DISABLED,
"CREATE AS SELECT is not supported with Replicated databases. Consider using separate CREATE and INSERT queries.");
} }
}
if (create.is_clone_as) if (create.is_clone_as)
{ {