mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix
This commit is contained in:
parent
221bb89343
commit
b47db5e0d6
@ -47,7 +47,7 @@ namespace ErrorCodes
|
||||
extern const int UNSUPPORTED_METHOD;
|
||||
}
|
||||
|
||||
static [[noreturn]] void renameat2(const std::string &, const std::string &, int)
|
||||
[[noreturn]] static void renameat2(const std::string &, const std::string &, int)
|
||||
{
|
||||
throw Exception("Compiled without renameat2() support", ErrorCodes::UNSUPPORTED_METHOD);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ void DatabaseAtomic::renameTable(const Context & context, const String & table_n
|
||||
throw Exception("Table " + backQuote(getDatabaseName()) + "." + backQuote(table_name) + " doesn't exist.", ErrorCodes::UNKNOWN_TABLE);
|
||||
|
||||
String old_metadata_path = getObjectMetadataPath(table_name);
|
||||
String new_metadata_path = to_database.getObjectMetadataPath(table_name);
|
||||
String new_metadata_path = to_database.getObjectMetadataPath(to_table_name);
|
||||
|
||||
if (this == &to_database)
|
||||
{
|
||||
|
@ -272,6 +272,7 @@ void DatabaseOnDisk::renameTable(
|
||||
table_metadata_path = getObjectMetadataPath(table_name);
|
||||
attach_query = parseQueryFromMetadata(log, context, table_metadata_path);
|
||||
auto & create = attach_query->as<ASTCreateQuery &>();
|
||||
create.database = to_database.getDatabaseName();
|
||||
create.table = to_table_name;
|
||||
if (from_ordinary_to_atomic)
|
||||
create.uuid = UUIDHelpers::generateV4();
|
||||
|
@ -382,7 +382,7 @@ void IStorage::alter(
|
||||
auto table_id = getStorageID();
|
||||
StorageInMemoryMetadata metadata = getInMemoryMetadata();
|
||||
params.apply(metadata);
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
setColumns(std::move(metadata.columns));
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ void StorageBuffer::alter(const AlterCommands & params, const Context & context,
|
||||
|
||||
StorageInMemoryMetadata metadata = getInMemoryMetadata();
|
||||
params.apply(metadata);
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
setColumns(std::move(metadata.columns));
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ void StorageDistributed::alter(const AlterCommands & params, const Context & con
|
||||
checkAlterIsPossible(params, context.getSettingsRef());
|
||||
StorageInMemoryMetadata metadata = getInMemoryMetadata();
|
||||
params.apply(metadata);
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
setColumns(std::move(metadata.columns));
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ void StorageMaterializedView::alter(
|
||||
}
|
||||
/// end modify query
|
||||
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
setColumns(std::move(metadata.columns));
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ void StorageMerge::alter(
|
||||
|
||||
StorageInMemoryMetadata storage_metadata = getInMemoryMetadata();
|
||||
params.apply(storage_metadata);
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, storage_metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, storage_metadata);
|
||||
setColumns(storage_metadata.columns);
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ void StorageMergeTree::alter(
|
||||
{
|
||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
|
||||
update_metadata();
|
||||
}
|
||||
@ -296,7 +296,7 @@ void StorageMergeTree::alter(
|
||||
|
||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
|
||||
update_metadata();
|
||||
|
||||
|
@ -53,7 +53,7 @@ void StorageNull::alter(
|
||||
|
||||
StorageInMemoryMetadata metadata = getInMemoryMetadata();
|
||||
params.apply(metadata);
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(context, table_id, metadata);
|
||||
setColumns(std::move(metadata.columns));
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ void StorageReplicatedMergeTree::setTableStructure(ColumnsDescription new_column
|
||||
}
|
||||
|
||||
auto table_id = getStorageID();
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(global_context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(global_context, table_id, metadata);
|
||||
|
||||
/// Even if the primary/sorting keys didn't change we must reinitialize it
|
||||
/// because primary key column types might have changed.
|
||||
@ -3270,7 +3270,7 @@ void StorageReplicatedMergeTree::alter(
|
||||
|
||||
changeSettings(metadata.settings_ast, table_lock_holder);
|
||||
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(query_context, table_id, metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(query_context, table_id, metadata);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3331,7 +3331,7 @@ void StorageReplicatedMergeTree::alter(
|
||||
/// Just change settings
|
||||
current_metadata.settings_ast = future_metadata.settings_ast;
|
||||
changeSettings(current_metadata.settings_ast, table_lock_holder);
|
||||
DatabaseCatalog::instance().getDatabaseAndTable(table_id).first->alterTable(query_context, table_id, current_metadata);
|
||||
DatabaseCatalog::instance().getDatabase(table_id.database_name)->alterTable(query_context, table_id, current_metadata);
|
||||
}
|
||||
|
||||
/// We can be sure, that in case of successfull commit in zookeeper our
|
||||
|
@ -6,3 +6,5 @@ CREATE LIVE VIEW lv AS SELECT * FROM test;
|
||||
DETACH TABLE lv;
|
||||
INSERT INTO test VALUES (42);
|
||||
DROP TABLE test;
|
||||
ATTACH TABLE lv;
|
||||
DROP TABLE lv;
|
||||
|
Loading…
Reference in New Issue
Block a user