ALTER TABLE MODIFY ignores COMMENT option

Details

Detail name Value
Changelog Number 5765
Type Bug
Status Resolved
Affected Versions EXASOL 6.0.0, EXASolution 5.0.0
Fix Versions Exasol 6.1.0
Resolution Date 2018-06-07
Problem

ALTER TABLE MODIFY can have a COMMENT option. However, that option does not work. Instead of changing the column comment the option is simply ignored.

Example
drop schema test cascade;
create schema test;

CREATE OR REPLACE TABLE t (c1 INT, c2 INT COMMENT IS 'This is an int');

SELECT column_type, column_comment
FROM exa_all_columns
WHERE column_schema = 'TEST'
  AND column_table = 'T';

-- > C2: DECIMAL(18,0) with correct comment 'This is an int'

ALTER TABLE t MODIFY COLUMN c2 CHAR(1) COMMENT IS 'This is a char';

SELECT column_type, column_comment
FROM exa_all_columns
WHERE column_schema = 'TEST'
  AND column_table = 'T';

--> C2: CHAR(1) with wrong comment 'This is an int'
Workaround

You can use the COMMENT ON statement for changing the column comment

COMMENT ON COLUMN t.c2 IS 'This is a char';

SELECT column_type, column_comment
FROM exa_all_columns
WHERE column_schema = 'TEST'
  AND column_table = 'T';

--> C2: CHAR(1) with correct comment 'This is a char'

Note that you still need ALTER TABLE MODIFY to change the column type.