This commit is contained in:
Alexander Tokmakov 2020-04-11 18:38:41 +03:00
parent f0edb65e33
commit 8b6c836720
4 changed files with 6 additions and 5 deletions

View File

@ -15,9 +15,9 @@ namespace ErrorCodes
{
extern const int UNKNOWN_TABLE;
extern const int TABLE_ALREADY_EXISTS;
extern const int FILE_DOESNT_EXIST;
extern const int CANNOT_ASSIGN_ALTER;
extern const int DATABASE_NOT_EMPTY;
extern const int NOT_IMPLEMENTED;
}
class AtomicDatabaseTablesSnapshotIterator final : public DatabaseTablesSnapshotIterator
@ -134,7 +134,7 @@ void DatabaseAtomic::renameTable(const Context & context, const String & table_n
db.tryCreateSymlink(table_name_, table_data_path_);
};
auto assertCanMoveMatView = [inside_database](const StoragePtr & table_)
auto assert_can_move_mat_view = [inside_database](const StoragePtr & table_)
{
if (inside_database)
return;
@ -165,12 +165,12 @@ void DatabaseAtomic::renameTable(const Context & context, const String & table_n
}
StoragePtr table = getTableUnlocked(table_name);
assertCanMoveMatView(table);
assert_can_move_mat_view(table);
StoragePtr other_table;
if (exchange)
{
other_table = other_db.getTableUnlocked(to_table_name);
assertCanMoveMatView(other_table);
assert_can_move_mat_view(other_table);
}
if (exchange)

View File

@ -36,7 +36,6 @@ namespace ErrorCodes
extern const int INCORRECT_FILE_NAME;
extern const int SYNTAX_ERROR;
extern const int TABLE_ALREADY_EXISTS;
extern const int UNKNOWN_TABLE;
extern const int DICTIONARY_ALREADY_EXISTS;
extern const int EMPTY_LIST_OF_COLUMNS_PASSED;
}

View File

@ -22,4 +22,5 @@ $CLICKHOUSE_CLIENT -q "ATTACH DATABASE test_01107 ENGINE=Atomic"
$CLICKHOUSE_CLIENT -q "SELECT count(n), sum(n) FROM test_01107.mt"
$CLICKHOUSE_CLIENT -q "INSERT INTO test_01107.mt SELECT number + sleepEachRow(3) FROM numbers(100)" &
sleep 1
$CLICKHOUSE_CLIENT -q "DROP DATABASE test_01107"

View File

@ -5,6 +5,7 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
$CLICKHOUSE_CLIENT -q "DROP DATABASE IF EXISTS test_01114_1"
$CLICKHOUSE_CLIENT -q "DROP DATABASE IF EXISTS test_01114_2"
$CLICKHOUSE_CLIENT -q "DROP DATABASE IF EXISTS test_01114_3"
$CLICKHOUSE_CLIENT -q "CREATE DATABASE test_01114_1 ENGINE=Atomic"