postgresql修改列类型

  • Post author:
  • Post category:其他


postgresql修改列类型

ALTER TABLE 表名 ALTER COLUMN 字段名 type 字段类型 USING 字段名::字段类型

比如修改列类型为bigint;

alter table TableName alter column F1 type bigint using F1::bigint;

比如修改project 表is_hit列的类型为bool;

alter table project_info.project  alter column is_hit type bool using is_hit::bool;

ps:错误: 无法把类型 smallint 转换为 boolean