Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stupid bug with settings alter #9435

Merged
merged 1 commit into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions dbms/src/Storages/AlterCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,11 @@ void AlterCommands::validate(const StorageInMemoryMetadata & metadata, const Con
ErrorCodes::NOT_FOUND_COLUMN_IN_BLOCK};
}
}
else if (command.type == AlterCommand::MODIFY_SETTING)
{
if (metadata.settings_ast == nullptr)
throw Exception{"Cannot alter settings, because table engine doesn't support settings changes", ErrorCodes::BAD_ARGUMENTS};
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CREATE TABLE log_for_alter (
Data String
) ENGINE = Log();

ALTER TABLE log_for_alter MODIFY SETTING aaa=123; -- { serverError 48 }
ALTER TABLE log_for_alter MODIFY SETTING aaa=123; -- { serverError 36 }

DROP TABLE IF EXISTS log_for_alter;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
15 changes: 15 additions & 0 deletions dbms/tests/queries/0_stateless/01089_alter_settings_old_format.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
DROP TABLE IF EXISTS old_format_mt;

CREATE TABLE old_format_mt (
event_date Date,
key UInt64,
value1 UInt64,
value2 String
)
ENGINE = MergeTree(event_date, (key, value1), 8192);

ALTER TABLE old_format_mt MODIFY SETTING enable_mixed_granularity_parts = 1; --{serverError 36}

SELECT 1;

DROP TABLE IF EXISTS old_format_mt;