trinodb/trino

Support DROP TABLE CASCADE

damian3031 opened this issue · 3 comments

Support DROP TABLE table_name CASCADE to automatically drop objects that depend on the table (such as views), and in turn all objects that depend on those objects.

sahoss commented

I am interested in contributing to this issue @damian3031. given this is a non-trivial fix, would a design summary shared on this issue be a good way to get started?

@sahoss yes, it's also worth to consider what the SQL spec says about this.

For example since Trino doesn't have contraints but underlying data sources might should a DROP TABLE table CASCADE also drop any references to columns from the dropped table from other tables?
If yes how do we detect them in a way that's consistent across connectors?

IMO personally this doesn't make too much sense unless we can define the problem being solved more concretely.
e.g. Do we want to be able to find and drop all dependent views only? Do we want to be able to do that for views created from external systems? What's the use-case we're trying to solve for.

cc: @martint