1
2
3
4
5 create [or replace] procedure procedure_name(parameter_list)
6language plpgsql
7as $$
8declare
9-- variable declaration
10begin
11-- stored procedure body
12end; $$
1SELECT n.nspname AS schema
2 ,proname AS fname
3 ,proargnames AS args
4 ,t.typname AS return_type
5 ,d.description
6 ,pg_get_functiondef(p.oid) as definition
7-- ,CASE WHEN NOT p.proisagg THEN pg_get_functiondef(p.oid)
8-- ELSE 'pg_get_functiondef() can''t be used with aggregate functions'
9-- END as definition
10 FROM pg_proc p
11 JOIN pg_type t
12 ON p.prorettype = t.oid
13 LEFT OUTER
14 JOIN pg_description d
15 ON p.oid = d.objoid
16 LEFT OUTER
17 JOIN pg_namespace n
18 ON n.oid = p.pronamespace
19 WHERE NOT p.proisagg
20 AND n.nspname~'<$SCHEMA_NAME_PATTERN>'
21 AND proname~'<$FUNCTION_NAME_PATTERN>'
22