Avoid stack overflow in materialized views, part 4: correct checks

This commit is contained in:
Alexey Milovidov 2020-10-16 03:37:53 +03:00
parent cc3feb36a6
commit 625d03d8c2
2 changed files with 10 additions and 0 deletions

View File

@ -79,6 +79,15 @@ bool StorageID::operator<(const StorageID & rhs) const
return !hasUUID();
}
bool StorageID::operator==(const StorageID & rhs) const
{
assertNotEmpty();
if (!hasUUID() && !rhs.hasUUID())
return std::tie(database_name, table_name) == std::tie(rhs.database_name, rhs.table_name);
else
return hasUUID() && rhs.hasUUID() && uuid == rhs.uuid;
}
String StorageID::getFullTableName() const
{
return backQuoteIfNeed(getDatabaseName()) + "." + backQuoteIfNeed(table_name);

View File

@ -68,6 +68,7 @@ struct StorageID
return uuid != UUIDHelpers::Nil;
}
bool operator==(const StorageID & rhs) const;
bool operator<(const StorageID & rhs) const;
void assertNotEmpty() const