Pour lister les procédures stockées d’une base PostgreSQL, vous pouvez utiliser la vue information_schema, le catalogue pg_proc ou la commande psql \df.
Vue information_schema.routines
SELECT routine_schema, routine_name
FROM information_schema.routines
WHERE routine_type = 'PROCEDURE';Catalogue pg_proc
SELECT n.nspname, p.proname
FROM pg_catalog.pg_namespace n
JOIN pg_catalog.pg_proc p ON p.pronamespace = n.oid
WHERE p.prokind = 'p' AND n.nspname = 'public';Pour obtenir la définition, vous pouvez ajouter p.prosrc ou utiliser pg_get_functiondef(p.oid).
Commande \df
\dfLa commande affiche aussi les fonctions. Le type de routine apparaît dans la colonne type.