Contents
pg_get_function_arguments()
A function for generating a function/procedure argument list
pg_get_function_arguments()
is a system function for generating the argument list for a function or procedure as a text string.
pg_get_function_arguments()
was added in PostgreSQL 8.4.
Usage
pg_get_function_arguments (oid
) →text
Change history
- PostgreSQL 8.4
- added (commit 69a785b8)
Examples
Basic usage example for pg_get_function_arguments()
:
postgres=# CREATE FUNCTION foo(id INT, message TEXT) RETURNS TEXT LANGUAGE SQL AS $$ SELECT message || ':' || id::TEXT $$; CREATE FUNCTION postgres=# SELECT pg_get_function_arguments('foo(int, text)'::regprocedure); pg_get_function_arguments --------------------------- id integer, message text (1 row)
Any default values are also emitted:
postgres=# CREATE FUNCTION bar (message TEXT DEFAULT 'no message supplied') RETURNS TEXT LANGUAGE SQL AS $$ SELECT 'The message is: ' || message $$; CREATE FUNCTION postgres=# SELECT pg_get_function_arguments('bar(text)'::regprocedure); pg_get_function_arguments -------------------------------------------------- message text DEFAULT 'no message supplied'::text (1 row)
References
- PostgreSQL documentation: System Catalog Information Functions