Deleting from one table also deletes from other table

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Deleting from one table also deletes from other table



Postgres on Linux



When I do the following command.


DELETE FROM some_table;



It also deletes data from another table. How do I found out how?





You have a on delete cascade constraint on this table to the other that the registries are being deleted
– Jorge Campos
Aug 8 at 14:51





When I do d some_table, I don't see foreign key or delete on cascade.
– BioRod
Aug 8 at 15:01


d some_table




1 Answer
1



There is probably a foreign key constraint that points to your table and is defined with ON DELETE CASCADE.


ON DELETE CASCADE



Alternatively, there may be a trigger on the table that deletes the rows.



In psql, use d some_table to see all such foreign keys and triggers.


psql


d some_table






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered