我创建了一个table_cleaned
liketable
并从table
into插入了唯一值table_cleaned
。现在我想更换table
与table_cleaned
使用
DROP TABLE table;
ALTER TABLE table_cleaned rename to table;
Run Code Online (Sandbox Code Playgroud)
但第一条语句给出了cannot drop table cals_status because other objects depend on it
.
我绝对不想使用,cascade
因为它会删除所有相关行。
我怎样才能安全地用干净的副本替换旧表?
按照 Erwin Brandstetter 的建议,这是错误消息的缺失细节:
Run Code Online (Sandbox Code Playgroud)DETAIL: default value for column id of table cals_status_deduplicated depends on sequence cals_status_id_seq