Created
March 11, 2014 19:05
-
-
Save ianpgall/9492728 to your computer and use it in GitHub Desktop.
PostgreSQL view that lists all functions and their source code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace view showfunctions as | |
select | |
l.lanname, | |
t.typname || ' = ' || n.nspname || '.' || | |
p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')' | |
as function_definition, | |
(select case when lanname <> 'c' | |
then '\n\n'||prosrc ||'\n\n' | |
else '\n'||prosrc ||'.so\n\n' | |
end) as source | |
from pg_proc p, pg_type t, pg_namespace n, pg_language l | |
where p.prorettype = t.oid and p.pronamespace = n.oid | |
and p.prolang = l.oid; |
select
l.lanname,
t.typname || ' = ' || n.nspname || '.' ||
p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')'
as function_definition,
(select case when lanname <> 'c'
then '\n\n'||prosrc ||'\n\n'
else '\n'||prosrc ||'.so\n\n'
end) as source
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
select
l.lanname,
t.typname || ' = ' || n.nspname || '.' ||
p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')'
as function_definition,
(select case when lanname <> 'c'
then '\n\n'||prosrc ||'\n\n'
else '\n'||prosrc ||'.so\n\n'
end) as source