3 ms·
Dependencies are a general problem, like changing the type of a table that has dependent views. It's a good idea if your database update scripts/migration softw
by mhd 7y ago
Dependencies are a general problem, like changing the type of a table that has dependent views. It's a good idea if your database update scripts/migration software can handle something like this. Other databases don't tend to be as strict as Postgres here (I only found out that some rarely-accessed views never quite worked after migrating from Oracle)
I've had good luck with these functions:
https://gist.github.com/mateuszwenus/11187288 https://gist.github.com/mateuszwenus/11187288
Allows you to save-and-drop dependent views (materialized or regular) and then restore them after your updates.
- Twisell 7y agoDeeply agree about dependencies being a general problem. Thanks for the script that look pretty clever #bookmarking. Like particularly the approach of "drop what you saved, no more no less". DROP CASCADE is simpler but can have undetected side effect, if this script fail to backup all dependency, logically you will get an error when attempting to delete target and that rocks.