8 deleted 132 characters in body
source | link

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand why it does this which is thatbecause this is the way it has been specified by the documentation, but themy question now is, in when is this ever expected behaviorbehaviour?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?
  • When the table that was just deleted is recreated, the foreign key reference is not restored. This is is understandable

Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand why it does this which is that this is the way it has been specified by the documentation, but the question now is, in when is this ever expected behavior?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?
  • When the table that was just deleted is recreated, the foreign key reference is not restored. This is is understandable

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand it does this because this is the way it has been specified by the documentation, but my question now is, when is this ever expected behaviour?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.

Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?

    Tweeted twitter.com/StackDBAs/status/653295959913459712
7 added 466 characters in body
source | link

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand why it does this which is that this is the way it has been specified by the documentation, but the question now is, in when is this ever expected behavior?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?
  • When the table that was just deleted is recreated, the foreign key reference is not restored. This is is understandable

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand why it does this which is that this is the way it has been specified by the documentation, but the question now is, in when is this ever expected behavior?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand why it does this which is that this is the way it has been specified by the documentation, but the question now is, in when is this ever expected behavior?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?
  • When the table that was just deleted is recreated, the foreign key reference is not restored. This is is understandable
6 added 466 characters in body
source | link

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

Can someone please explainEDIT: Ok, I understand why it does this which is that this is the way it has been specified by the documentation, but the question now is, in when is this ever expected behavior?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

Can someone please explain why this is?

I am still relatively new to psql and I was just finishing an assignment when I decided to try something which was to drop a table which other tables depend on due to a foreign key relationship. My expectation was that any table that had a foreign key reference to the table I am dropping will have (at least) all their rows deleted and the table dropped as well. This was not the case. The tables are still there and even though I specified CASCADE, nothing happened to the rows of those tables.

However using TRUNCATE ... CASCADE on the referenced table does in fact remove the rows in the other tables

EDIT: Ok, I understand why it does this which is that this is the way it has been specified by the documentation, but the question now is, in when is this ever expected behavior?

  • DROPing a domian with CASCADE removes every column in any table that uses that domain.
  • DROPing a table with a view attached to it will delete the view.
  • Why does it make sense that dropping a table which is referenced by other tables does not delete the tables that reference this one as well? Convienience?
5 deleted 355 characters in body
source | link
4 added 355 characters in body
source | link
3 added 36 characters in body; edited tags
source | link
2 edited tags
| link
1
source | link