开发者

Why SQL can't infer tables dependencies when dropping multiple tables with constraints?

开发者 https://www.devze.com 2023-01-24 15:12 出处:网络
Greetings, It\'s a general SQL question not tied to any specific implementation but more on global concepts.

Greetings,

It's a general SQL question not tied to any specific implementation but more on global concepts.

Let's take a simple example, I have 2 tables:

  • User (with FK on Group)
  • Group

Why when doing DROP TABLE group, user; the server can't infer tables dependency and reorder table names internally to do a successful drop ?

What is the purpose of making it fail ?

  • Because developer are already so laz开发者_StackOverflowy, and they need some dependencies challenges during their time...
  • Because no SQL database developer had this idea before...

Or without sarcasm:

  • By design... bad design
  • For security purpose... but don't see what security breach this 'feature' is helpful for ?
  • Or it's simply a misunderstanding of SQL concept from my part

Would love to understand, thanks you !


In some RDBMSes, like PostgreSQL, you can use the CASCADE keyword to drop dependencies as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消