postgresql - Get all procedural , user defined functions -
how list of user defined functions via sql
query ?
i find code here
select p.proname, p.pronargs, t.typname pg_proc p, pg_language l, pg_type t p.prolang = l.oid , p.prorettype = t.oid , l.lanname = 'c' order proname;
but gets c-functions
how user defined, procedural language functions, writen example in plpgsql
language?
consider:
select pp.proname, pl.lanname, pn.nspname, pg_get_functiondef(pp.oid) pg_proc pp inner join pg_namespace pn on (pp.pronamespace = pn.oid) inner join pg_language pl on (pp.prolang = pl.oid) pl.lanname not in ('c','internal') , pn.nspname not 'pg_%' , pn.nspname <> 'information_schema';
see also: what command find script of existing function in postgresql?
use pg_get_functiondef
or prosrc
column pg_proc
directly. key idea join on pg_namespace
, filter out postgresql catalog functions, adequate purposes:
from pg_proc pp inner join pg_namespace on (pp.pronamespace = pn.oid) pn.nspname <> 'pg_catalog'
the trouble obtaining source code user defined functions deciding user means. many types of functions can created:
- functions using
create extension
. - functions created postgresql.
- functions compiled , installed administrator.
superusers sufficent grants can define functions in pg_proc
, don't.
since superusers can create c language functions, exclude them. such functions can custom-installed on particular database admin, not normal user.
Comments
Post a Comment