我如何使用查询来确定一个函数在postgresql中是否是标量?

jmp7cifd  于 5个月前  发布在  PostgreSQL
关注(0)|答案(1)|浏览(77)

我不知道如何在postgres数据库中获取标量函数列表。
我试过编写不同的查询,但我找不到一个精确的解决方案来确定函数返回的标量类型。到目前为止,我想到的唯一解决方案是用正则表达式过滤函数返回类型的名称。

zlhcx6iw

zlhcx6iw1#

如果你所说的 scalar 是指非集返回,那么系统目录pg_procproretset可以告诉你:demo

select oid::regprocedure, prorettype::regtype 
from pg_proc where not proretset and prokind in ('a','f','w');

字符串
('a','f','w')表示聚合函数、常规函数和窗口函数。值得看一下返回类型,因为根据上面假设的定义,returns voidreturns triggerreturns cursor也是标量函数。
标准information_schema.routines不以任何方式区分标量和非标量函数。

相关问题