Re: Deleting Functions

From: "Jim Buttafuoco" <jim(at)contactbda(dot)com>
To: Scott Petersen <scottpetersen(at)softhome(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Deleting Functions
Date: 2006-08-23 19:56:11
Message-ID: 20060823195430.M44644@contactbda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Scott,

I use the following query with psql \o option. Change the schema name from public to whatever. I am sure you could put
this into a plpgsql function using execute as well.

Jim

\o drops.sql
select 'drop function ' || nspname || '.' || proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ');' from
pg_proc p join pg_namespace b on (p.pronamespace=b.oid) where nspname='public';
\o
\!vi drops.sql # <<remove the fluff from the query
\i drops.sql

---------- Original Message -----------
From: Scott Petersen <scottpetersen(at)softhome(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Sent: Wed, 23 Aug 2006 13:29:12 -0600
Subject: [SQL] Deleting Functions

> Folks,
>
> I am using PGSQL do do all of my schema changes, but have run into a
> problem. I need to be able to DROP all of the USER FUNCTIONS that are
> defined in a schema. The problem is that I do not know the names of all
> of the functions and parameters. I know that I could use '\df' and then
> use perl or some other scripting language to parse this, but I need to
> be able to perform this action on multiple platforms (without rewriting
> the process for each platform).
>
> I have written a script that incorporates '\df' and appropriate parsing
> to perform this action for LINUX and it works fine/lasts a long time. I
> need to make this more transparent so it will run on all platforms (in
> particular windows).
>
> I know that in the past (version 7) there was a way to drop the
> functions by directly accessing some of the system tables. The
> question/problem is that we have updated to version 8.1 and need the
> same functionality.
>
> Any help or directions would be greatly appreciated.
>
> Thanks Scott.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
------- End of Original Message -------

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-08-23 21:26:57 Re: All columns from table in a joined query
Previous Message Sumeet 2006-08-23 19:44:35 Re: All columns from table in a joined query