postgresql,

How to list Stored Procedures in PostgreSQL

Feb 09, 2022 · 1 min read · Post a comment
How to list Stored Procedures in PostgreSQL

Stored procedures or simply put procedures are just SQL codes that can be saved for later use. There are few ways you could list them though, found below.

Prerequisites

  • PostgreSQL

List all procedures using SQL query

SELECT   nspname, proname
FROM     pg_catalog.pg_namespace ns
JOIN     pg_catalog.pg_proc pr
ON       pronamespace = ns.oid
WHERE    nspname = 'public'
ORDER BY proname;

List all procedures using PSQL

\df

View procedure code

\df+ <function_name>

Conclusion

Other potentially useful PostgreSQL listing queries:

On a side note, follow our official channel on Telegram.