Talk About Network

Google




Play Stock Market Games
Fantasy Stock Picking Contest

Data Bases > Pgsql General > Scripting funct...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 15503 of 16301
Post > Topic >>

Scripting function definitions as SQL?

by postgres.developer@[EMAIL PROTECTED] ("Postgres User") May 11, 2008 at 06:12 AM

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.  So does anyone know if the code
has already been written by someone else?


SELECT p.proname AS name, p.oid, p.proargtypes AS args, ds.description
, p.prorettype AS rettype,
 p.proretset, p.probin, p.proisstrict AS strict, p.prosrc AS body,
l.lanname AS lang,
 u.usename, p.prosecdef, p.provolatile, p.proisagg, n.nspname,
proargnames, p.proargmodes, p.proallargtypes
FROM pg_proc p
LEFT OUTER JOIN pg_description ds ON ds.objoid = p.oid
INNER JOIN pg_namespace n ON p.pronamespace = n.oid
INNER JOIN pg_language l ON l.oid = p.prolang
LEFT OUTER JOIN pg_user u ON u.usesysid = p.proowner
WHERE n.nspname = 'main'
ORDER BY p.proname, n.nspname

-- 
Sent via pgsql-general mailing list (pgsql-general@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
 




 7 Posts in Topic:
Scripting function definitions as SQL?
postgres.developer@[EMAIL  2008-05-11 06:12:40 
Re: Scripting function definitions as SQL?
kleptog@[EMAIL PROTECTED]  2008-05-11 15:49:37 
Re: Scripting function definitions as SQL?
postgres.developer@[EMAIL  2008-05-11 11:28:37 
Re: Scripting function definitions as SQL?
depesz@[EMAIL PROTECTED]   2008-05-11 20:43:25 
Re: Scripting function definitions as SQL?
postgres.developer@[EMAIL  2008-05-11 12:08:36 
Re: Scripting function definitions as SQL?
reece@[EMAIL PROTECTED]   2008-05-11 22:27:51 
Re: Scripting function definitions as SQL?
singh.gurjeet@[EMAIL PROT  2008-05-12 12:38:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Fri Aug 8 13:28:49 CDT 2008.