I am migrating some data to another server while dropping all sequences/functions/views. When I try to do simply
DROP VIEW | SEQUENCE | FUNCTION | AGGREGATE without
CASCADE, errors are thrown to indicate dependencies. The goal is that if no data (=tables?) will be affected by using
CASCADE, then I can use it.
Assumption: if no table is dependent on views/functions/sequences, then no table will be affected by using
Then I guess using
CASCADE for views will be fine since they always depend on some base tables.
For functions and sequences I am not very sure. I haven't written that many of sql functions myself and I don't know if the data in a table are generated by some function, whether it means the table depends on the function.
For sequences, it seems that a sequence will be generated automatically by postgres if I use
serial as column type. My first guess would be that in this case, the table that is using
serial depends on the sequence. However, by testing on a dummy database on my laptop, I found that the data seems to be unaffected. (I just use
SELECT COUNT(*) FROM TABLE_NAME after dropping the sequence)