------=_Part_2259_28836120.1210576118463
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Mon, May 12, 2008 at 10:57 AM, Reece Hart <reece@[EMAIL PROTECTED]
> wrote:
> On Sun, 2008-05-11 at 06:12 -0700, Postgres User wrote:
> > Has anyone written a function that scripts out all the functions in a
> > database as full SQL statements (Create Function.....)
>
> You could pg_dump the schema in the "custom" format (-Fc), then call
> pg_restore with -l to get the TOC, grep the TOC for functions, and feed
> that back into pg_restore with -L. It sounds like a lot, but it's pretty
> easy in practice, like so:
>
> $ sudo -u postgres pg_dump -Fc -s mydb >mydb.pgdfc
> $ pg_restore -l mydb.pgdfc >mydb.toc
> $ grep -E '^[0-9]+; [0-9]+ [0-9]+ FUNCTION' mydb.toc >mydb-fx.toc
> $ pg_restore -L mydb-fx.toc mydb.pgdfc
>
> The output of pg_restore is sql.
>
> This technique is extremely useful for other kinds of schema elements as
> well.
>
>
It's a bit too much for the task at hand. Recently I was also faced with a
situation where I wanted to dump a few functions (only), but pg_dump does
not have any option to do so!!
Can we have an option to dump function?
Best regards,
--
gurjeet[.singh]@[EMAIL PROTECTED]
gmail | hotmail | indiatimes | yahoo }.com
EnterpriseDB http://www.enterprisedb.com
Mail sent from my BlackLaptop device
------=_Part_2259_28836120.1210576118463
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Mon, May 12, 2008 at 10:57 AM, Reece Hart <<a
href="mailto:reece@[EMAIL PROTECTED]
">reece@[EMAIL PROTECTED]
>> wrote:<br><div
class="gmail_quote"><blockquote class="gmail_quote" style="border-left:
1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
1ex;">
<div class="Ih2E3d">On Sun, 2008-05-11 at 06:12 -0700, Postgres User
wrote:<br>
> Has anyone written a function that scripts out all the functions in
a<br>
> database as full SQL statements (Create Function.....)<br>
<br>
</div>You could pg_dump the schema in the "custom" format (-Fc),
then call<br>
pg_restore with -l to get the TOC, grep the TOC for functions, and
feed<br>
that back into pg_restore with -L. It sounds like a lot, but it's
pretty<br>
easy in practice, like so:<br>
<br>
$ sudo -u postgres pg_dump -Fc -s mydb >mydb.pgdfc<br>
$ pg_restore -l mydb.pgdfc >mydb.toc<br>
$ grep -E '^[0-9]+; [0-9]+ [0-9]+ FUNCTION' mydb.toc
>mydb-fx.toc<br>
$ pg_restore -L mydb-fx.toc mydb.pgdfc<br>
<br>
The output of pg_restore is sql.<br>
<br>
This technique is extremely useful for other kinds of schema elements
as<br>
well.<br>
<br></blockquote></div><br>It's a bit too much for the task at hand.
Recently I was also faced with a situation where I wanted to dump a few
functions (only), but pg_dump does not have any option to do
so!!<br><br>Can we have an option to dump function?<br>
<br>Best regards,<br><br>--
<br>gurjeet[.singh]@[EMAIL PROTECTED]
>singh.gurjeet@[EMAIL PROTECTED]
gmail | hotmail |
indiatimes | yahoo }.com<br><br>EnterpriseDB <a
href="http://www.enterprisedb.com">http://www.enterprisedb.com</a><br><br>
Mail sent from my BlackLaptop device
------=_Part_2259_28836120.1210576118463--


|