I have the following query to retrieve function definitions:
select pg_get_functiondef
from (
select pp.proname, pl.lanname,pn.nspname, pg_get_functiondef(pp.oid)
from pg_proc pp
inner join pg_namespace pn on (pp.pronamespace = pn.oid)
inner join pg_language pl on (pp.prolang = pl.oid)
where pl.lanname = 'plpgsql' and
pn.nspname = 'pga'
) f
where pg_get_functiondef like '%userid%'
I just need functions containing a certain text in the definition.
When I run it, this error is thrown:
"ERROR: "array_agg" is an aggregate function"
If I run just the inner query, it returns all the definitions as expected. No error.
I have also tried this where clause:
where pg_get_functiondef(pp.oid) like '%userid%'
But doesn't work either. How to do it?