Skip to content

Instantly share code, notes, and snippets.

@rgwozdz
Created March 14, 2017 17:42
Show Gist options
  • Select an option

  • Save rgwozdz/538e57bd3bc94355a4e902972eb35c37 to your computer and use it in GitHub Desktop.

Select an option

Save rgwozdz/538e57bd3bc94355a4e902972eb35c37 to your computer and use it in GitHub Desktop.
SELECT n.nspname as "Schema",
p.proname as "Name",
pg_catalog.pg_get_function_result(p.oid) as "Result data type",
pg_catalog.pg_get_function_arguments(p.oid) as "Argument data types",
CASE
WHEN p.proisagg THEN 'agg'
WHEN p.proiswindow THEN 'window'
WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN 'trigger'
ELSE 'normal'
END as "Type"
FROM pg_catalog.pg_proc p
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
WHERE pg_catalog.pg_function_is_visible(p.oid)
AND n.nspname <> 'pg_catalog'
AND n.nspname <> 'information_schema'
ORDER BY 1, 2, 4;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment