mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #56026 from ClickHouse/make_code_worse
Fix some bad code by making it worse
This commit is contained in:
commit
eacf1ee79b
@ -621,7 +621,8 @@ void DatabaseReplicated::checkQueryValid(const ASTPtr & query, ContextPtr query_
|
||||
|
||||
if (auto * create = query->as<ASTCreateQuery>())
|
||||
{
|
||||
bool replicated_table = create->storage && create->storage->engine && startsWith(create->storage->engine->name, "Replicated");
|
||||
bool replicated_table = create->storage && create->storage->engine &&
|
||||
(startsWith(create->storage->engine->name, "Replicated") || startsWith(create->storage->engine->name, "Shared"));
|
||||
if (!replicated_table || !create->storage->engine->arguments)
|
||||
return;
|
||||
|
||||
@ -761,8 +762,9 @@ BlockIO DatabaseReplicated::tryEnqueueReplicatedDDL(const ASTPtr & query, Contex
|
||||
static UUID getTableUUIDIfReplicated(const String & metadata, ContextPtr context)
|
||||
{
|
||||
bool looks_like_replicated = metadata.find("Replicated") != std::string::npos;
|
||||
bool looks_like_shared = metadata.find("Shared") != std::string::npos;
|
||||
bool looks_like_merge_tree = metadata.find("MergeTree") != std::string::npos;
|
||||
if (!looks_like_replicated || !looks_like_merge_tree)
|
||||
if (!(looks_like_replicated || looks_like_shared) || !looks_like_merge_tree)
|
||||
return UUIDHelpers::Nil;
|
||||
|
||||
ParserCreateQuery parser;
|
||||
@ -772,7 +774,8 @@ static UUID getTableUUIDIfReplicated(const String & metadata, ContextPtr context
|
||||
const ASTCreateQuery & create = query->as<const ASTCreateQuery &>();
|
||||
if (!create.storage || !create.storage->engine)
|
||||
return UUIDHelpers::Nil;
|
||||
if (!startsWith(create.storage->engine->name, "Replicated") || !endsWith(create.storage->engine->name, "MergeTree"))
|
||||
if (!(startsWith(create.storage->engine->name, "Replicated") || startsWith(create.storage->engine->name, "Shared"))
|
||||
|| !endsWith(create.storage->engine->name, "MergeTree"))
|
||||
return UUIDHelpers::Nil;
|
||||
chassert(create.uuid != UUIDHelpers::Nil);
|
||||
return create.uuid;
|
||||
|
@ -902,8 +902,8 @@ namespace
|
||||
{
|
||||
void checkTemporaryTableEngineName(const String& name)
|
||||
{
|
||||
if (name.starts_with("Replicated") || name == "KeeperMap")
|
||||
throw Exception(ErrorCodes::INCORRECT_QUERY, "Temporary tables cannot be created with Replicated or KeeperMap table engines");
|
||||
if (name.starts_with("Replicated") || name.starts_with("Shared") || name == "KeeperMap")
|
||||
throw Exception(ErrorCodes::INCORRECT_QUERY, "Temporary tables cannot be created with Replicated, Shared or KeeperMap table engines");
|
||||
}
|
||||
|
||||
void setDefaultTableEngine(ASTStorage &storage, DefaultTableEngine engine)
|
||||
|
Loading…
Reference in New Issue
Block a user