在 Redshift 中删除表时,我收到一条错误消息:
Amazon Invalid operation: cannot drop table rawdata.bss_edw_customer_account because other objects depend on it;
我不想使用 CASCADE,因为我不知道它会杀死哪些其他表/ View 。如何找出哪些表或 View 依赖于我要删除的表?我想确保我不会侵犯别人的工作。
谢谢
最佳答案
对象 [1] 和约束 [2] 依赖关系的 Redshift 管理 View 可以帮助识别依赖对象。您还可以按照 DROP 表文档 [3] 中的说明创建 find_depend View 来查看任何依赖项。
我还发现这些 View 可能并不总是将物化 View 列为依赖对象。如果您过去创建过任何 MV,那么您可能需要使用 View DDL 检查依赖关系。以下查询可能会有所帮助:
select schemaname, viewname from pg_views where schemaname not like 'pg_catalog' and schemaname not like 'information_schema' and definition like '%<tablename>%';
[1] https://github.com/awslabs/amazon-redshift-utils/blob/master/src/AdminViews/v_object_dependency.sql
[3] https://docs.aws.amazon.com/redshift/latest/dg/r_DROP_TABLE.html
关于amazon-redshift - Redshift - 如何显示 CASCADE 将删除的依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62334766/