Closed wildtayne closed 6 years ago
I gathered some information about generating a script to list/drop functions. The internal function oidvectortypes
is the magic sauce as seen in this query:
SELECT 'DROP FUNCTION ' || ns.nspname || '.' || p.proname
|| '(' || oidvectortypes(p.proargtypes) || ');'
FROM pg_proc p JOIN pg_namespace ns ON p.pronamespace = ns.oid
WHERE ns.nspname = 'classdb'
ORDER BY p.proname;
Useful sources;
This is an awesome function @smurthys. I was also thinking that somehow listing all functions owned by ClassDB
would be the best way to solve this issue.
After investigating #147, it seems these two issues are linked fairly tightly. I will post an update here later.
I did some experimenting after our discussion, it seems one fairly simple solution we didn't discuss is to use DROP OWNED BY ClassDB
. If this encounters any dependency issues, it throws a very helpful exception, for example:
DETAIL: view m2ins01.insview depends on table classdb.rolebase
The one exception to this is that objects that are owned by superusers, for example, the event triggers and log import function, must be explicitly dropped first. I've pushed an implementation of this to the remove-uninstaller-uname-dep
branch. It seems to work as intended the testing I've performed locally.
Fixed in #161
addFrequentViews.sql
adds several new objects toPublic
that are not removed byremoveFromDB.sql
. I suggest that we simply addDROP * IF EXISTS
statements toremoveFromDB.sql
for each object needing to be dropped. An initial list of such objects is:Public.describe(VARCHAR(63))
Public.getMyActivitySummary()
Public.getMyDDLActivity()
Public.getMyConnectionActivity()
Public.getMyActivity()
Public.MyDDLActivity
Public.MyConnectionActivity
Public.MyActivity
Public.MyActivitySummary