mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Ignore MODIFY_COLUMN
commands without column type when parsing mutation commands
This commit is contained in:
parent
d0c36c613d
commit
1523df6ec3
@ -115,7 +115,10 @@ std::optional<MutationCommand> MutationCommand::parse(ASTAlterCommand * command,
|
||||
res.column_name = getIdentifierName(command->column);
|
||||
return res;
|
||||
}
|
||||
else if (parse_alter_commands && command->type == ASTAlterCommand::MODIFY_COLUMN)
|
||||
/// MODIFY COLUMN x REMOVE MATERIALIZED is a valid alter command, but doesn't have any specified column type, thus no mutation is needed
|
||||
else if (
|
||||
parse_alter_commands && command->type == ASTAlterCommand::MODIFY_COLUMN && command->col_decl
|
||||
&& command->col_decl->as<ASTColumnDeclaration &>().type)
|
||||
{
|
||||
MutationCommand res;
|
||||
res.ast = command->ptr();
|
||||
|
@ -0,0 +1,8 @@
|
||||
BEFORE a_r1 x String
|
||||
BEFORE a_r1 y String MATERIALIZED \'str\'
|
||||
BEFORE a_r2 x String
|
||||
BEFORE a_r2 y String MATERIALIZED \'str\'
|
||||
AFTER a_r1 x String
|
||||
AFTER a_r1 y String
|
||||
AFTER a_r2 x String
|
||||
AFTER a_r2 y String
|
@ -0,0 +1,14 @@
|
||||
DROP TABLE IF EXISTS a_r1 SYNC;
|
||||
DROP TABLE IF EXISTS a_r2 SYNC;
|
||||
CREATE TABLE a_r1 (x String, y String MATERIALIZED 'str') ENGINE = ReplicatedMergeTree('/clickhouse/{database}/a', 'r1') ORDER BY x;
|
||||
CREATE TABLE a_r2 (x String, y String MATERIALIZED 'str') ENGINE = ReplicatedMergeTree('/clickhouse/{database}/a', 'r2') ORDER BY x;
|
||||
|
||||
INSERT INTO a_r1 SELECT toString(number) FROM numbers(100);
|
||||
SELECT 'BEFORE', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table LIKE 'a\_r%' ORDER BY table, name;
|
||||
|
||||
ALTER TABLE a_r1
|
||||
ADD INDEX IF NOT EXISTS some_index x TYPE set(16) GRANULARITY 1,
|
||||
MODIFY COLUMN y REMOVE MATERIALIZED
|
||||
SETTINGS alter_sync = 2, mutations_sync = 2;
|
||||
|
||||
SELECT 'AFTER', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table LIKE 'a\_r%' ORDER BY table, name;
|
Loading…
Reference in New Issue
Block a user