Skip site navigation (1) Skip section navigation (2)

Re: Drop Functions Question Again

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Garcia, Joshua" <Joshua(dot)Garcia(at)xerox(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Drop Functions Question Again
Date: 2006-07-22 17:29:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
"Garcia, Joshua" <Joshua(dot)Garcia(at)xerox(dot)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)

(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

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Dawid KuroczkoDate: 2006-07-23 18:41:27
Subject: Re: [NOVICE] The name of the game
Previous:From: Tom LaneDate: 2006-07-22 17:19:03
Subject: Re: initdb fails quietly

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group