Re: [GENERAL] Scripting function definitions as SQL?

2008-05-12 Thread Gurjeet Singh
On Mon, May 12, 2008 at 10:57 AM, Reece Hart [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

[GENERAL] Scripting function definitions as SQL?

2008-05-11 Thread Postgres User
Has anyone written a function that scripts out all the functions in a database as full SQL statements (Create Function.) I found the below SQL will return all the fields needed to build a SQL statement, but it would take some work to combine the field values correctly to get the right format.

Re: [GENERAL] Scripting function definitions as SQL?

2008-05-11 Thread Martijn van Oosterhout
On Sun, May 11, 2008 at 06:12:40AM -0700, Postgres User wrote: Has anyone written a function that scripts out all the functions in a database as full SQL statements (Create Function.) I found the below SQL will return all the fields needed to build a SQL statement, but it would take some

Re: [GENERAL] Scripting function definitions as SQL?

2008-05-11 Thread Postgres User
Unfortunately I didn't see a way to tell pg_dump to dump only objects of a specific type, like functions or sequences. It requires additional coding to parse the output and that's less than ideal... Does pg_dump not do what you want? On Sun, May 11, 2008 at 6:49 AM, Martijn van Oosterhout

Re: [GENERAL] Scripting function definitions as SQL?

2008-05-11 Thread hubert depesz lubaczewski
On Sun, May 11, 2008 at 11:28:37AM -0700, Postgres User wrote: Unfortunately I didn't see a way to tell pg_dump to dump only objects of a specific type, like functions or sequences. It requires additional coding to parse the output and that's less than ideal... hmmm .. additional coding seems

Re: [GENERAL] Scripting function definitions as SQL?

2008-05-11 Thread Postgres User
Yes, but I'm doing this from a Delphi program in Windows and that's why I'm looking for a solution that's SQL-based. It would be nice if one of the system catalog views handled it. hmmm .. additional coding seems a bit too much for a simple thing like this: pg_dump -s | perl -ne 'print if

Re: [GENERAL] Scripting function definitions as SQL?

2008-05-11 Thread Reece Hart
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