I feel like I have a very basic/stupid question, yet I never saw/read/heard anything in this direction.

Say I have a table *users(userId, name)* and a table *preferences(id, userId, language)*. The example is trivial but could be extended to a situation with multi-level relations and way more tables..  

When my UI requests to delete a user I first want to show a warning stating that also its preferences will be deleted. If at some point the database gets extended with more tables and relationships, but the software isn't adapted accordingly (the client didn't update) a generic message should be shown.

How can I implement this? The UI cannot know about the whole data structure and should not be bothered to walk down all the relations to manually delete all the depending records. 

I would think this would be with constraints.  

The constraint would be *no action* at first so the constraint will throw an error that can be caught by the UI. After the UI receives a confirmation, the constraint should become a *cascade*.

Somehow I'm feeling like I'm getting this all wrong..