본문으로 바로가기
본문으로 바로가기

ALTER TABLE ... MODIFY COMMENT

테이블 comment를, 이전에 설정되어 있었는지와 관계없이 추가, 수정 또는 제거합니다. comment 변경 사항은 system.tablesSHOW CREATE TABLE 쿼리 모두에 반영됩니다.

구문

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

예시

주석이 포함된 테이블을 생성하려면 다음과 같이 합니다:

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─┐
│         │
└─────────┘

주의사항

복제된 테이블(Replicated Table)에서는 레플리카마다 주석이 서로 다를 수 있습니다. 주석을 수정하면 단일 레플리카에만 적용됩니다.

이 기능은 23.9 버전부터 사용할 수 있습니다. 이전 ClickHouse 버전에서는 동작하지 않습니다.