Merge pull request #19064 from CurtizJ/restrict-modify-ttl

Restrict MODIFY TTL for tables created in old syntax
This commit is contained in:
alexey-milovidov 2021-01-15 14:09:47 +03:00 committed by GitHub
commit 8d58ce532a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -1506,6 +1506,12 @@ void MergeTreeData::checkAlterIsPossible(const AlterCommands & commands, const S
"ALTER MODIFY ORDER BY is not supported for default-partitioned tables created with the old syntax", "ALTER MODIFY ORDER BY is not supported for default-partitioned tables created with the old syntax",
ErrorCodes::BAD_ARGUMENTS); ErrorCodes::BAD_ARGUMENTS);
} }
if (command.type == AlterCommand::MODIFY_TTL && !is_custom_partitioned)
{
throw Exception(
"ALTER MODIFY TTL is not supported for default-partitioned tables created with the old syntax",
ErrorCodes::BAD_ARGUMENTS);
}
if (command.type == AlterCommand::MODIFY_SAMPLE_BY) if (command.type == AlterCommand::MODIFY_SAMPLE_BY)
{ {
if (!is_custom_partitioned) if (!is_custom_partitioned)

View File

@ -0,0 +1,6 @@
DROP TABLE IF EXISTS ttl_old_syntax;
CREATE TABLE ttl_old_syntax (d Date, i Int) ENGINE = MergeTree(d, i, 8291);
ALTER TABLE ttl_old_syntax MODIFY TTL toDate('2020-01-01'); -- { serverError 36 }
DROP TABLE ttl_old_syntax;