无法删除表用户,因为其他对象依赖它 [英] cannot drop table users because other objects depend on it
本文介绍了无法删除表用户,因为其他对象依赖它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将表拖放到数据库中。
但是,例如,当我使用
DROP TABLE如果存在用户;
我会收到此消息:
无法删除表用户,因为其他对象依赖该表用户
我发现解决方案是删除所有数据库。但是,无论如何,如何在不完全删除数据的情况下解决此问题?解决方案使用
级联
选项:DROP TABLE(如果存在用户级联);
这将删除引用
用户$ c的所有外键$ c>表或使用它的任何视图。
它不会删除其他表(或从其中删除行)。
I want to drop my tables in database. But, when I use, for example,
DROP TABLE if exists users;
I receive this message:
cannot drop table users because other objects depend on it
I found the solution is to drop all database. But, anyway, how to solve this problem without total data removal?
解决方案Use the
cascade
option:DROP TABLE if exists users cascade;
this will drop any foreign key that is referencing the
users
table or any view using it.It will not drop other tables (or delete rows from them).
这篇关于无法删除表用户,因为其他对象依赖它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文