【发布时间】:2022-01-06 12:30:43
【问题描述】:
目标
- 我想将 Redshift SUPER column 添加到现有的 redshift 表中。
- 我需要这个来在那里存储 JSON 数据
代码
这就是我通常添加新列的方式。
ALTER TABLE products
ADD COLUMN created_at NOT NULL;
1.试过了
CREATE TABLE temp_test_persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
ALTER TABLE temp_test_persons ADD COLUMN newSuperColumn SUPER NOT NULL;
运行查询时出错:定义为 NOT NULL 的 ALTER TABLE ADD COLUMN 必须具有非空默认表达式
经过审核的解决方案
- Alter column data type in Amazon Redshift
- AWS Redshift - Add IDENTITY column to existing table
- Adding column to existing tables
- Add dynamic column to existing MySQL table?
- SQLAlchemy: How to add column to existing table?
- adding columns to an existing table
- add column to existing table postgres
- How to add not null unique column to existing table
- Adding columns to existing csv file using super-csv
- UCanAccess: Add column to existing table
- Adding columns to existing redshift table
- How to add column to existing table in laravel?
- Add column to existing table in rds
- oracle add column to existing table
【问题讨论】:
-
您是否尝试简单地将数据类型添加到您的语句中?
ALTER TABLE products ADD COLUMN newSuperColumn SUPER NOT NULL; -
我试过了,但它返回了一个错误(你可以在我编辑的帖子中看到它)。
标签: sql amazon-web-services amazon-redshift