How to get stored procedure args list from metadata tables ?

Started by Gauthier, Daveabout 13 years ago7 messagesgeneral
Jump to latest
#1Gauthier, Dave
dave.gauthier@intel.com

Hi:

Looking for a table or view which contains the list of arguments that are passed to a stored procedure. Doesn't seem to be in pg_proc.prosrc or other pg_proc columns.

Thanks in Advance for any help.

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Gauthier, Dave (#1)
Re: How to get stored procedure args list from metadata tables ?

Hello

2013/2/13 Gauthier, Dave <dave.gauthier@intel.com>:

Hi:

Looking for a table or view which contains the list of arguments that are
passed to a stored procedure. Doesn't seem to be in pg_proc.prosrc or other
pg_proc columns.

It is in pg_proc - argument's description is stored in combination of
fields: pronargs, pronargdefaults, proargtypes, proallargtypes,
proargmodes, proargnames, proargdefaults

system function pg_get_function_arguments can returns usual description

postgres=# select pg_get_function_arguments('check_form_rodne_cislo'::regproc);
pg_get_function_arguments
────────────────────────────
character varying, boolean
(1 row)

regards

Pavel Stehule

Thanks in Advance for any help.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Gauthier, Dave (#1)
Re: How to get stored procedure args list from metadata tables ?

On 02/13/2013 06:13 AM, Gauthier, Dave wrote:

Hi:

Looking for a table or view which contains the list of arguments that
are passed to a stored procedure. Doesn't seem to be in pg_proc.prosrc
or other pg_proc columns.

Thanks in Advance for any help.

http://www.postgresql.org/docs/9.2/interactive/catalog-pg-proc.html

proargtype, proallargtypes, proargmodes, proargnames, proargdefaults

Example:

production=# SELECT proargnames from pg_proc where proname
='close_tag_order';

proargnames

--------------------------------------

{_order_no,not_rcv_ct,tag_change_ct}

--
Adrian Klaver
adrian.klaver@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Gauthier, Dave (#1)
Re: How to get stored procedure args list from metadata tables ?

Dave Gauthier wrote:

Looking for a table or view which contains the list of arguments that are passed to a stored
procedure. Doesn't seem to be in pg_proc.prosrc or other pg_proc columns.

This information is in the following columns of pg_proc:
proargtypes, proallargtypes, proargmodes, proargnames

For a nice display, use
SELECT pg_get_function_identity_arguments('funcname'::regproc);

Yours,
Laurenz Albe

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Gauthier, Dave
dave.gauthier@intel.com
In reply to: Laurenz Albe (#4)
Re: How to get stored procedure args list from metadata tables ?

Excellent !
Thank You very much !

-----Original Message-----
From: Albe Laurenz [mailto:laurenz.albe@wien.gv.at]
Sent: Wednesday, February 13, 2013 9:30 AM
To: Gauthier, Dave; pgsql-general@postgresql.org
Subject: RE: How to get stored procedure args list from metadata tables ?

Dave Gauthier wrote:

Looking for a table or view which contains the list of arguments that
are passed to a stored procedure. Doesn't seem to be in pg_proc.prosrc or other pg_proc columns.

This information is in the following columns of pg_proc:
proargtypes, proallargtypes, proargmodes, proargnames

For a nice display, use
SELECT pg_get_function_identity_arguments('funcname'::regproc);

Yours,
Laurenz Albe

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#6Gauthier, Dave
dave.gauthier@intel.com
In reply to: Adrian Klaver (#3)
Re: How to get stored procedure args list from metadata tables ?

Actually, how do you discriminate between 2 different procedures that have the same name but different number of args (using pg_get_function_arguments)? The function bocks when the procedure name is not unique.

-----Original Message-----
From: Adrian Klaver [mailto:adrian.klaver@gmail.com]
Sent: Wednesday, February 13, 2013 9:26 AM
To: Gauthier, Dave
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] How to get stored procedure args list from metadata tables ?

On 02/13/2013 06:13 AM, Gauthier, Dave wrote:

Hi:

Looking for a table or view which contains the list of arguments that
are passed to a stored procedure. Doesn't seem to be in
pg_proc.prosrc or other pg_proc columns.

Thanks in Advance for any help.

http://www.postgresql.org/docs/9.2/interactive/catalog-pg-proc.html

proargtype, proallargtypes, proargmodes, proargnames, proargdefaults

Example:

production=# SELECT proargnames from pg_proc where proname ='close_tag_order';

proargnames

--------------------------------------

{_order_no,not_rcv_ct,tag_change_ct}

--
Adrian Klaver
adrian.klaver@gmail.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7Gauthier, Dave
dave.gauthier@intel.com
In reply to: Pavel Stehule (#2)
Re: How to get stored procedure args list from metadata tables ?

Is there anything like this soln for v8.3.4 ?
I know, I know, just upgrade. But its out of my hands.

-----Original Message-----
From: Pavel Stehule [mailto:pavel.stehule@gmail.com]
Sent: Wednesday, February 13, 2013 9:24 AM
To: Gauthier, Dave
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] How to get stored procedure args list from metadata tables ?

Hello

2013/2/13 Gauthier, Dave <dave.gauthier@intel.com>:

Hi:

Looking for a table or view which contains the list of arguments that
are passed to a stored procedure. Doesn't seem to be in
pg_proc.prosrc or other pg_proc columns.

It is in pg_proc - argument's description is stored in combination of
fields: pronargs, pronargdefaults, proargtypes, proallargtypes, proargmodes, proargnames, proargdefaults

system function pg_get_function_arguments can returns usual description

postgres=# select pg_get_function_arguments('check_form_rodne_cislo'::regproc);
pg_get_function_arguments
────────────────────────────
character varying, boolean
(1 row)

regards

Pavel Stehule

Thanks in Advance for any help.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general