0

I am using the following sql to get the definition of a function:

SELECT prosrc FROM pg_proc WHERE proname = 'my_func'

It works good but it doesn't include the create or replace function my_func(args) part, when I want to know the input arguments and output arguments, I have to read the code in the function body, which is not convenient.

So, I would ask how to get the full source code of the function body definition.

1

1 Answer 1

2

To get the function definition you can use the following query.

select pg_get_functiondef(oid)
from pg_proc
where proname = 'functionname';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.