ALTER TABLE ... MODIFY COMMENT

ALTER TABLE ... MODIFY COMMENT

테이블에 설정된 주석(comment)을 추가하거나 수정, 또는 제거할 수 있어요. 이전에 주석이 설정되어 있었는지와 상관없이 동작하며, 변경된 주석은 system.tablesSHOW CREATE TABLE 쿼리 양쪽에 모두 반영됩니다.

출처: 문서

본문

Syntax

ALTER TABLE [db].name [ON CLUSTER cluster] MODIFY COMMENT 'Comment'

Examples

주석을 가진 테이블을 만들려면 이렇게 해요.

CREATE TABLE table_with_comment
(
    `k` UInt64,
    `s` String
)
ENGINE = Memory()
COMMENT 'The temporary table';

테이블 주석을 수정하려면 이렇게 해요.

ALTER TABLE table_with_comment
MODIFY COMMENT 'new comment on a table';

수정된 주석을 확인하려면 이렇게 해요.

SELECT comment
FROM system.tables
WHERE database = currentDatabase() AND name = 'table_with_comment';
┌─comment────────────────┐
│ new comment on a table │
└────────────────────────┘

테이블 주석을 제거하려면 이렇게 해요.

ALTER TABLE table_with_comment MODIFY COMMENT '';

주석이 제거되었는지 확인하려면 이렇게 해요.

SELECT comment
FROM system.tables
WHERE database = currentDatabase() AND name = 'table_with_comment';
┌─comment─┐
│         │
└─────────┘

Caveats

Replicated 테이블의 경우, 주석은 리플리카마다 서로 다를 수 있어요. 주석을 수정하는 작업은 단일 리플리카에만 적용됩니다.

이 기능은 버전 23.9부터 사용할 수 있으며, 이전 ClickHouse 버전에서는 동작하지 않아요.

더 알아보기 (Learn more)