Add a test case

This commit is contained in:
helifu 2024-04-12 18:19:37 +08:00
parent 7db140c6b3
commit a52d77b625
3 changed files with 9 additions and 4 deletions

View File

@ -189,7 +189,6 @@ namespace ErrorCodes
extern const int CANNOT_SCHEDULE_TASK;
extern const int LIMIT_EXCEEDED;
extern const int CANNOT_FORGET_PARTITION;
extern const int PARTITION_ALREADY_EXISTS;
}
static void checkSuspiciousIndices(const ASTFunction * index_function)
@ -5107,9 +5106,7 @@ void MergeTreeData::movePartitionToTable(const PartitionCommand & command, Conte
/// The target table and the source table are the same.
if (dest_storage->getStorageID() == this->getStorageID())
{
throw Exception(ErrorCodes::PARTITION_ALREADY_EXISTS, "Cannot move partition to oneself.");
}
return;
auto * dest_storage_merge_tree = dynamic_cast<MergeTreeData *>(dest_storage.get());
if (!dest_storage_merge_tree)

View File

@ -0,0 +1,2 @@
tuple() 1000000
tuple() 1000000

View File

@ -0,0 +1,6 @@
DROP TABLE IF EXISTS move_partition_to_oneself;
CREATE TABLE move_partition_to_oneself (key UInt64 CODEC(NONE)) ENGINE = MergeTree ORDER BY tuple();
INSERT INTO move_partition_to_oneself SELECT number FROM numbers(1e6);
SELECT partition, rows FROM system.parts WHERE database = currentDatabase() AND table = 'move_partition_to_oneself' and active;
ALTER TABLE move_partition_to_oneself MOVE PARTITION tuple() TO TABLE move_partition_to_oneself;
SELECT partition, rows FROM system.parts WHERE database = currentDatabase() AND table = 'move_partition_to_oneself' and active;