PostgreSQL: Script to List Functions
PostgreSQL: Script to List Functions
You can list all user-defined and system functions in PostgreSQL using system catalogs.
List Functions in Current Database
SELECT routine_name
FROM information_schema.routines
WHERE routine_type = 'FUNCTION'
AND routine_schema = 'public';
List Functions with Definition
SELECT proname, pg_get_functiondef(p.oid)
FROM pg_proc p
JOIN pg_namespace n ON n.oid = p.pronamespace
WHERE n.nspname = 'public';
This is helpful when auditing or documenting database logic.
Comments
Post a Comment