diff --git a/dbms/src/Storages/AlterCommands.cpp b/dbms/src/Storages/AlterCommands.cpp index 4948d884647..cebc4a4b2ba 100644 --- a/dbms/src/Storages/AlterCommands.cpp +++ b/dbms/src/Storages/AlterCommands.cpp @@ -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}; + } } } diff --git a/dbms/tests/queries/0_stateless/00980_merge_alter_settings.sql b/dbms/tests/queries/0_stateless/00980_merge_alter_settings.sql index d650218e99a..6bf043fe4c8 100644 --- a/dbms/tests/queries/0_stateless/00980_merge_alter_settings.sql +++ b/dbms/tests/queries/0_stateless/00980_merge_alter_settings.sql @@ -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; diff --git a/dbms/tests/queries/0_stateless/01089_alter_settings_old_format.reference b/dbms/tests/queries/0_stateless/01089_alter_settings_old_format.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/dbms/tests/queries/0_stateless/01089_alter_settings_old_format.reference @@ -0,0 +1 @@ +1 diff --git a/dbms/tests/queries/0_stateless/01089_alter_settings_old_format.sql b/dbms/tests/queries/0_stateless/01089_alter_settings_old_format.sql new file mode 100644 index 00000000000..15d3ac508cb --- /dev/null +++ b/dbms/tests/queries/0_stateless/01089_alter_settings_old_format.sql @@ -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;