SELECT CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||
       pg_catalog.format_type(p.prorettype, NULL) as "Result data type",
       n.nspname as "Schema",
       p.proname as "Name",
       pg_catalog.oidvectortypes(p.proargtypes) as "Argument data types",
       u.usename as "Owner",
       l.lanname as "Language",
       p.prosrc as "Source code",
       pg_catalog.obj_description(p.oid, 'pg_proc') as "Description"
  FROM pg_catalog.pg_proc p
       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
       LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang
       LEFT JOIN pg_catalog.pg_user u ON u.usesysid = p.proowner,
       (SELECT $1 AS cmd) AS cmd,
       pg_catalog.pg_name_pattern($2) AS (schpat text, funcpat text)
 WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype
   AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype
   AND NOT p.proisagg
   AND n.nspname ~ schpat
   AND p.proname ~ funcpat
 ORDER BY 2, 3, 1, 4