PG查询用户自定义函数或存储过程
可以使用\df
或pg_proc系统表,如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | lhrdb=# \df List of functions Schema | Name | Result data type | Argument data types | Type --------+--------------------------+------------------+---------------------+------ public | add | integer | integer, integer | func public | pr_update_goods_map_code | integer | | func public | test | integer | id uuid | func public | triple | | INOUT x integer | proc (4 rows) lhrdb=# SELECT n.nspname as "Schema", lhrdb-# p.proname as "Name", lhrdb-# pg_catalog.pg_get_function_result(p.oid) as "Result data type", lhrdb-# pg_catalog.pg_get_function_arguments(p.oid) as "Argument data types", lhrdb-# CASE p.prokind lhrdb-# WHEN 'a' THEN 'agg' lhrdb-# WHEN 'w' THEN 'window' lhrdb-# WHEN 'p' THEN 'proc' lhrdb-# ELSE 'func' lhrdb-# END as "Type" lhrdb-# FROM pg_catalog.pg_proc p lhrdb-# LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace lhrdb-# WHERE pg_catalog.pg_function_is_visible(p.oid) lhrdb-# AND n.nspname <> 'pg_catalog' lhrdb-# AND n.nspname <> 'information_schema' lhrdb-# ORDER BY 1, 2, 4; Schema | Name | Result data type | Argument data types | Type --------+--------------------------+------------------+---------------------+------ public | add | integer | integer, integer | func public | pr_update_goods_map_code | integer | | func public | test | integer | id uuid | func public | triple | | INOUT x integer | proc (4 rows) |