This commit is contained in:
János Benjamin Antal 2024-08-28 02:16:49 +02:00 committed by GitHub
commit d6ba33cffa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 2 deletions

View File

@ -3226,7 +3226,7 @@ Default value: `0`.
## lightweight_deletes_sync {#lightweight_deletes_sync}
The same as 'mutation_sync', but controls only execution of lightweight deletes.
The same as [`mutations_sync`](#mutations_sync), but controls only execution of lightweight deletes.
Possible values:

View File

@ -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();

View File

@ -0,0 +1,4 @@
BEFORE a x String
BEFORE a y String MATERIALIZED \'str\'
AFTER a x String
AFTER a y String

View File

@ -0,0 +1,13 @@
DROP TABLE IF EXISTS a SYNC;
CREATE TABLE a (x String, y String MATERIALIZED 'str') ENGINE = ReplicatedMergeTree('/clickhouse/{database}/a', 'r1') ORDER BY x;
INSERT INTO a SELECT toString(number) FROM numbers(100);
SELECT 'BEFORE', table, name, type, default_kind, default_expression FROM system.columns WHERE database = currentDatabase() AND table = 'a' ORDER BY table, name;
-- DROP INDEX is important to make the mutation not a pure metadata mutation
ALTER TABLE a
DROP INDEX IF EXISTS some_index,
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 = 'a' ORDER BY table, name;