Skip to content

Commit 6b751b7

Browse files
Backport ClickHouse#91573 to 25.8: Disallow ALTERs for Object Storage table engines
1 parent acc8e03 commit 6b751b7

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/Storages/ObjectStorage/StorageObjectStorageConfiguration.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,16 @@ class StorageObjectStorageConfiguration
213213
const std::optional<FormatSettings> & /*format_settings*/) {}
214214
virtual void checkMutationIsPossible(const MutationCommands & /*commands*/) {}
215215

216-
virtual void checkAlterIsPossible(const AlterCommands & /*commands*/) {}
216+
virtual void checkAlterIsPossible(const AlterCommands & commands)
217+
{
218+
for (const auto & command : commands)
219+
{
220+
if (!command.isCommentAlter())
221+
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Alter of type '{}' is not supported by storage {}",
222+
command.type, getEngineName());
223+
}
224+
}
225+
217226
virtual void alter(const AlterCommands & /*params*/, ContextPtr /*context*/) {}
218227

219228
virtual const DataLakeStorageSettings & getDataLakeSettings() const

tests/queries/0_stateless/03629_storage_s3_disallow_index_alter.reference

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- Tags: no-fasttest
2+
-- Tag no-fasttest: Depends on S3
3+
-- Issue: https://github.com/ClickHouse/ClickHouse/issues/87059
4+
5+
DROP TABLE IF EXISTS test_03629;
6+
CREATE TABLE test_03629 (a UInt64) ENGINE = S3(s3_conn, filename='test_03629_{_partition_id}', format='Native') PARTITION BY a;
7+
ALTER TABLE test_03629 ADD INDEX a_idx a TYPE set(0); -- { serverError NOT_IMPLEMENTED }
8+
ALTER TABLE test_03629 ADD PROJECTION a_proj (SELECT a + 1 ORDER BY a); -- { serverError NOT_IMPLEMENTED }
9+
10+
DROP TABLE test_03629;

0 commit comments

Comments
 (0)