PostgreSQL 修改列报错:cannot be cast automatically to type integer

PostgreSQL 修改列报错:cannot be cast automatically to type integer
正常的修改语句:ALTER TABLE table_name ALTER COLUMN column_name TYPE integer;

执行会报错,cannot be cast automatically to type integer


调整执行语句:ALTER TABLE table_name ALTER COLUMN column_name TYPE integer USING(column_name::integer);

运行正常。

推荐阅读