无法删除表用户,因为其他对象依赖它 [英] cannot drop table users because other objects depend on it

查看:1082
本文介绍了无法删除表用户,因为其他对象依赖它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将表拖放到数据库中。
但是,例如,当我使用
DROP TABLE如果存在用户;
我会收到此消息:


无法删除表用户,因为其他对象依赖该表用户


解决方案

使用级联选项:

  DROP TABLE(如果存在用户级联); 

这将删除引用用户表或使用它的任何视图。



它不会删除其他(或从其中删除行)。


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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆