On Tue, Sep 25, 2001 at 02:20:23PM -0400, Mihai Gheorghiu wrote:
> I want to write a function that finds out whether a function already exists.
> Is that possible? How?
select * from pg_proc where proname = ??;
you can run psql with switch -E, then it shows intenal queries
it performs. Eg., for \df - 'show functions' it does:
$ psql -E
marko=# \df
********* QUERY *********
SELECT format_type(p.prorettype, NULL) as "Result", p.proname as
"Function",
oidvectortypes(p.proargtypes) as "Arguments"
FROM pg_proc p
WHERE p.prorettype <> 0 and (pronargs = 0 or
oidvectortypes(p.proargtypes) <> '')
ORDER BY "Function", "Result", "Arguments"
*************************
from there you can hack further.
--
marko