In this article, we see how to get list of user defined functions in PostgreSQL database. We can get list function by using following methods:
1. Querying against pg_catalog.
2. Using meta-command.
1. Querying against pg_catalog
Go to the database where we want to check the list of functions:
\c r2schools
Run the below query
SELECT quote_ident(n.nspname) as schema , quote_ident(p.proname) as function FROM pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace WHERE n.nspname not like 'pg%' and n.nspname not like 'information_schema%';
Output:
schema | function --------+---------------- public | getnames public | getnames public | tst_dates_func public | dept public | empinfo public | addition
2. Using meta-command.
Go to the database where we want to check the list of functions:
\c r2schools
Run the below query
\df
Visual output for above two methods: