I can’t figure out how to get a list of scalar functions in a postgres database.
I’ve tried to write different queries, but I can’t find an exact solution to determine the scalar type returned by a function.
So far the only solution that has come to mind is filtering the name of the function return type with a regular expression.
2
Answers
You can use
INFORMATION_SCHEMA.ROUTINES
to get the datatype of the functions.Adding the datatype to the where clause will give you all functions.
But the returned rows are only form the current Schame/databse.
If by scalar you mean non-set-returning, system catalog
pg_proc
columnproretset
can tell you that: demo('a','f','w')
mean aggregate, regular and window functions. It’s worth taking a look at return types because with the definition assumed above, a function thatreturns void
,returns trigger
,returns cursor
is also scalar.The standard
information_schema.routines
does not differentiate between scalar and non-scalar functions in any way.