将列数据类型从数组更改为整数 [英] change column datatype from array to integer
本文介绍了将列数据类型从数组更改为整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将列的数据类型从_float8更改为int4
I need to change the data type of a column from _float8 to int4
ALTER TABLE "table" ALTER COLUMN "col" SET DATA TYPE int4;
列 col的结果不能自动转换为整数
ALTER TABLE "table" ALTER COLUMN "col" SET DATA TYPE int4 USING (col::integer);
结果无法将类型double precision []转换为整数
有什么想法吗?
推荐答案
您必须指出
alter table x alter column y set data type int4 using (y[1]::int)
这篇关于将列数据类型从数组更改为整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文