在AWS红移,试图使用命令IDENTITY列添加到现有表时
ALTER TABLE table_name的ADD列ID BIGINT IDENTITY(1,1);
我收到以下错误
错误:ALTER TABLE ADD COLUMN不支持类型IDENTITY列
这显然意味着,这根本是不红移不允许的。我是否需要删除并重新创建表?或者是有一些变通的解决方案得到这个红移做?
解决方案您必须添加身份
表声明中的列。你以后就不能添加。
文档: 不能使用ALTER TABLE ADD COLUMN命令修改下表和列属性:
UNIQUE
首要的关键
参考文献(外键)
IDENTITY
In AWS Redshift, when attempting to add an IDENTITY column to an existing table using the command
ALTER TABLE table_name ADD COLUMN id bigint IDENTITY(1,1);
I get the following error
ERROR: ALTER TABLE ADD COLUMN does not support columns with type IDENTITY
Which obviously implies that this simply isn't allowed in Redshift. Will I need to drop and recreate the table? Or is there some workaround solution to get this done in Redshift?
解决方案You must add IDENTITY
column during table declaration. And you can't add it later.
Docs: You cannot use an ALTER TABLE ADD COLUMN command to modify the following table and column attributes:
UNIQUE
PRIMARY KEY
REFERENCES (foreign key)
IDENTITY
上一篇:如何让你的Android应用程序的编译/版本号?你的、版本号、应用程序、oid
下一篇:如何使用Ubuntu 14.04在AWS弹性魔豆的Python Django应用程序如何使用、应用程序、弹性、魔豆