Re: Drop Functions Question Again - Mailing list pgsql-novice

From Tom Lane
Subject Re: Drop Functions Question Again
Date
Msg-id 27252.1153589361@sss.pgh.pa.us
Whole thread Raw
In response to Drop Functions Question Again  ("Garcia, Joshua" <Joshua.Garcia@xerox.com>)
List pgsql-novice
"Garcia, Joshua" <Joshua.Garcia@xerox.com> writes:
> I know this has been asked by other people in the past, but the archives
> don't show that anyone actually answered the question.  Is there any way
> to drop all the custom-created functions I add to the database in one
> command?

Not per se.  If you search the PG archives, you can find examples of
plpgsql functions that people have written to trawl through the system
catalogs and build DROP commands for all objects meeting some criteria
or other.

Also, as of PG 8.1 you can get a textual list of all objects owned by a
given user by trying to drop the user:

regression=# drop user foo;
ERROR:  role "foo" cannot be dropped because some objects depend on it
DETAIL:  owner of function fooey2(integer,integer)
owner of function fooey(integer,integer)
regression=#

(Don't try this in pre-8.1, you'll end up with a lot of orphaned
objects :-()

For a one-shot problem, the easiest thing might be to capture that in
a text file and then edit it down to the command script you need.  If
you expect to do it often then it'd be worth the trouble to write a
function.

            regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: initdb fails quietly
Next
From: Fred Frazelle
Date:
Subject: Is there a gui front end for this wonderful db program which works like MSAccess?