X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 786B39FB1EA for ; Wed, 23 Aug 2006 16:56:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 27830-01 for ; Wed, 23 Aug 2006 16:56:12 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from amanda.contactbda.com (ipn36372-e65122.cidr.lightship.net [216.204.66.226]) by postgresql.org (Postfix) with ESMTP id EFE0B9F9B01 for ; Wed, 23 Aug 2006 16:56:12 -0300 (ADT) Received: from amanda.contactbda.com (amanda.contactbda.com [192.168.1.2]) by amanda.contactbda.com (8.12.11/8.12.11/Debian-3) with ESMTP id k7NJuBoe008679; Wed, 23 Aug 2006 15:56:11 -0400 From: "Jim Buttafuoco" To: Scott Petersen , pgsql-sql@postgresql.org Reply-To: jim@contactbda.com Subject: Re: Deleting Functions Date: Wed, 23 Aug 2006 15:56:11 -0400 Message-Id: <20060823195430.M44644@contactbda.com> In-Reply-To: <44ECAC88.4060208@softhome.net> References: <44ECAC88.4060208@softhome.net> X-Mailer: Open WebMail 2.41 20040926 X-OriginatingIP: 192.168.1.1 (jim) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.183 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/171 X-Sequence-Number: 26129 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 # < To: pgsql-sql@postgresql.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 -------