pgadmin4/web/pgadmin/misc/templates/sqlautocomplete/sql/11_plus/functions.sql
2021-03-12 11:17:25 +05:30

19 lines
867 B
SQL

{# ============= Fetch the list of functions based on given schema_names ============= #}
SELECT n.nspname schema_name,
p.proname func_name,
p.proargnames arg_names,
COALESCE(proallargtypes::regtype[], proargtypes::regtype[])::text[] arg_types,
p.proargmodes arg_modes,
prorettype::regtype::text return_type,
CASE WHEN p.prokind = 'a' THEN true ELSE false END is_aggregate,
CASE WHEN p.prokind = 'w' THEN true ELSE false END is_window,
p.proretset is_set_returning,
d.deptype = 'e' is_extension,
pg_catalog.pg_get_expr(proargdefaults, 0) AS arg_defaults
FROM pg_catalog.pg_proc p
INNER JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
LEFT JOIN pg_catalog.pg_depend d ON d.objid = p.oid and d.deptype = 'e'
WHERE p.prorettype::regtype != 'trigger'::regtype
AND n.nspname IN ({{schema_names}})
ORDER BY 1, 2