Alter column data type in Amazon Redshift

前端 未结 9 1014
攒了一身酷
攒了一身酷 2020-12-12 20:45

How to alter column data type in Amazon Redshift database?

I am not able to alter the column data type in Redshift; is there any way to modify the data type in Amazo

9条回答
  •  死守一世寂寞
    2020-12-12 21:22

    to avoid the schema change mentioned by Tomasz:

    BEGIN TRANSACTION;
    
    ALTER TABLE  RENAME TO _OLD;
    CREATE TABLE  (  );
    INSERT INTO  ()
    SELECT 
    FROM _OLD;
    DROP TABLE _OLD;
    
    END TRANSACTION;
    

提交回复
热议问题