What SQL Script in Postgres to return the Functions of a Schema?

Asked

Viewed 65 times

1

What SQL Script in Postgres to return the Functions of a Schema with its input parameters ?

  • Guys I just put dicar of how to get this information, is not question.. I research a lot and only find in the stack in English.. and so I’m putting in more streamlined scripts for people who are appearing... Thank you.. ** there is no need to be negative...** you may notice that it was me who answered, if it is not legal what I did I can delete without problems, just wanted to help

  • Here Gustavo your question also has problems, like the previous one, if you want to change ask a question really.

  • 1

    OK, correcting.... Thank you...

  • I want to ask more questions like this with the simplest possible answers. for beginners to better understand these scripts...

  • I understood Gustavo, the initial problem was really your questions and answers without a context, but of course a good answer. Whenever you ask questions and answer try to make the most of it

1 answer

3

SELECT 
    inf.routine_name, 
    par.data_type, 
    par.ordinal_position,
    par.parameter_name,
    par.parameter_mode
FROM 
    information_schema.routines inf
LEFT OUTER JOIN
     information_schema.parameters par ON inf.specific_name = par.specific_name
WHERE 
    inf.specific_schema='name_schema' and
    par.parameter_mode = 'IN'
ORDER BY 
    inf.routine_name, 
    par.ordinal_position;

or Shows Functions Not Linked to Triggers

SELECT 
    format('%I.%I(%s)', 
    ns.nspname, 
    p.proname, 
    pg_get_function_arguments(p.oid))
FROM 
    pg_proc p 
left outer JOIN 
    pg_namespace ns ON (p.pronamespace = ns.oid)
WHERE 
    ns.nspname = 'seu esquema' and
    p.proretset = true;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.