在Redshift中,如果视图依赖于您的表格,无论是否引用了您的列,您似乎都无法删除列。
第1步 - 创建表
create table codenames
(
id int identity(0, 1),
name text,
code text
)
第2步 - 创建视图
create view codenames_names_only
as
select name
from codenames;
第3步 - 删除未使用的列
alter table codenames
drop column code;
此时,您收到以下错误:
Error: ERROR: cannot drop table x column code because other objects depend on it
Hint: Use DROP ... CASCADE to drop the dependent objects too.
以上在准系统PostgreSQL(SQLFiddle link)
中工作正常思考?如何在不删除/修改视图的情况下解决这个问题?
答案 0 :(得分:1)
这似乎是2013年公认的错误,但仍未在2016年修复。