Re: pg_proc Question

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Oisin Glynn <me(at)oisinglynn(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_proc Question
Date: 2006-11-02 15:07:24
Message-ID: 20061102150724.GC2516@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Nov 02, 2006 at 09:57:28AM -0500, Oisin Glynn wrote:
> I have named all my functions in a pretty unique way and would like to
> export just my functions. Is there any way to move just these functions
> from one db to another.has anyone got a clever piece of SQL that spits
> out ddl from a select on pg_proc? Or could I use the copy command on
> pg_proc to spit my functions to file and then copy them into the new db?
> My issue is that I have allot of dblink and other things I do not want
> or need in the db and do not want to propagate this any further.

I would say the easiest is to use pg_dump and then filter the output.
It's simple enough for sed I think:

pg_dump database | sed -ne '/^CREATE FUNCTION tag/,/^--/p'

works well here... Replace tag with a pattern matching your functions.
If you're using pl/pgsql you may need to do something more clever with
the end marker...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter 2006-11-02 15:18:11 Re: Weird double single quote issue
Previous Message Oisin Glynn 2006-11-02 14:57:28 pg_proc Question