pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
cleaning up useless pl/pgsql functions
5+ messages / 4 participants
[nested] [flat]

* cleaning up useless pl/pgsql functions
@ 2003-06-30 21:13 Tomasz Myrta <jasiek@klaster.net>
  2003-06-30 21:32 ` Re: cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
  2003-07-01 00:39 ` Re: cleaning up useless pl/pgsql functions Rod Taylor <rbt@rbt.ca>
  2003-07-01 03:40 ` Re: cleaning up useless pl/pgsql functions Mendola Gaetano <mendola@bigfoot.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Tomasz Myrta @ 2003-06-30 21:13 UTC (permalink / raw)
  To: pgsql-sql

Hi
Do you have any easy script to remove all pl/pgsql function? After a lot of 
changes inside "create or replace function..." scripts I have a big mess. I 
want to remove all user defined pl/pgsql functions and restore some of them 
from my scripts again.


Regards,
Tomasz Myrta




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cleaning up useless pl/pgsql functions
  2003-06-30 21:13 cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
@ 2003-06-30 21:32 ` Tomasz Myrta <jasiek@klaster.net>
  2003-06-30 22:02   ` Re: cleaning up useless pl/pgsql functions Josh Berkus <josh@agliodbs.com>
  2 siblings, 1 reply; 5+ messages in thread

From: Tomasz Myrta @ 2003-06-30 21:32 UTC (permalink / raw)
  To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-sql

Dnia 2003-06-30 23:13, Użytkownik Tomasz Myrta napisał:
> Hi
> Do you have any easy script to remove all pl/pgsql function? After a lot 
> of changes inside "create or replace function..." scripts I have a big 
> mess. I want to remove all user defined pl/pgsql functions and restore 
> some of them from my scripts again.
> 
> 
> Regards,
> Tomasz Myrta

Hmm Answer to myself:

DELETE from pg_proc where prolang =(select oid from pg_language where 
lanname='plpgsq');

What do you think about it?

Tomasz




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cleaning up useless pl/pgsql functions
  2003-06-30 21:13 cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
  2003-06-30 21:32 ` Re: cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
@ 2003-06-30 22:02   ` Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Josh Berkus @ 2003-06-30 22:02 UTC (permalink / raw)
  To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-sql

Tomasz, 

> Hmm Answer to myself:
> 
> DELETE from pg_proc where prolang =(select oid from pg_language where 
> lanname='plpgsq');
> 
> What do you think about it?

You probably also want to put a "proowner = {your userid}" condition in there, 
just in case there are any builtins/contrib stuff that uses plpgsql.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cleaning up useless pl/pgsql functions
  2003-06-30 21:13 cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
@ 2003-07-01 00:39 ` Rod Taylor <rbt@rbt.ca>
  2 siblings, 0 replies; 5+ messages in thread

From: Rod Taylor @ 2003-07-01 00:39 UTC (permalink / raw)
  To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-sql

On Mon, 2003-06-30 at 21:13, Tomasz Myrta wrote:
> Hi
> Do you have any easy script to remove all pl/pgsql function? After a lot of 
> changes inside "create or replace function..." scripts I have a big mess. I 
> want to remove all user defined pl/pgsql functions and restore some of them 
> from my scripts again.

DROP PROCEDURAL LANGUAGE plpgsql CASCADE;
CREATE PROCEDURAL LANGUAGE plpgsql ...

-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

Attachments:

  signature.asc (application/pgp-signature, 186B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: cleaning up useless pl/pgsql functions
  2003-06-30 21:13 cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
@ 2003-07-01 03:40 ` Mendola Gaetano <mendola@bigfoot.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Mendola Gaetano @ 2003-07-01 03:40 UTC (permalink / raw)
  To: Tomasz Myrta <jasiek@klaster.net>; pgsql-sql

"Tomasz Myrta" <jasiek@klaster.net> wrote:
> Hi
> Do you have any easy script to remove all pl/pgsql function? After a lot
of
> changes inside "create or replace function..." scripts I have a big mess.
I
> want to remove all user defined pl/pgsql functions and restore some of
them
> from my scripts again.

You shall be able to identify the name of your own function and do:

SELECT 'DROP function ' || proname || ' ('||  oidvectortypes(proargtypes) ||
');' from pg_proc WHERE proname ~ '^sp_';

I identify my own function because the prefix sp_.


I hope that this help you.

Gaetano





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-07-01 03:40 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-30 21:13 cleaning up useless pl/pgsql functions Tomasz Myrta <jasiek@klaster.net>
2003-06-30 21:32 ` Tomasz Myrta <jasiek@klaster.net>
2003-06-30 22:02   ` Josh Berkus <josh@agliodbs.com>
2003-07-01 00:39 ` Rod Taylor <rbt@rbt.ca>
2003-07-01 03:40 ` Mendola Gaetano <mendola@bigfoot.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox