Reputation: 10068
In postgres when I drop a table it is dropping all views that depend upon it. Is there a way to persist the views so that they dont get dropped
Note: the table will be regenerated on daily basis with new data.
Upvotes: 1
Views: 3985
Reputation: 21
Try TRUNCATE TABLE / CREATE TABLE IF NOT EXISTS instead of DROP.
Upvotes: 0
Reputation: 2706
DROP TABLE always removes any indexes, rules, triggers, and constraints that exist for the target table. However, to drop a table that is referenced by a view or a foreign-key constraint of another table, CASCADE must be specified. (CASCADE will remove a dependent view entirely, but in the foreign-key case it will only remove the foreign-key constraint, not the other table entirely.)
Upvotes: 2