getting function argument names from psql?

Started by Timothy Perrigoover 19 years ago9 messagesgeneral
Jump to latest
#1Timothy Perrigo
tperrigo@wernervas.com

Is there a way to get the names of the arguments to a function from
psql? /df and /df+ return the parameter types, but not their names.

Thanks,
Tim

#2Michael Fuhr
mike@fuhr.org
In reply to: Timothy Perrigo (#1)
Re: getting function argument names from psql?

On Wed, Jul 12, 2006 at 07:33:09AM -0700, Timothy Perrigo wrote:

Is there a way to get the names of the arguments to a function from
psql? /df and /df+ return the parameter types, but not their names.

One way would be to look at pg_proc.proargnames.

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

--
Michael Fuhr

#3Merlin Moncure
mmoncure@gmail.com
In reply to: Timothy Perrigo (#1)
Re: getting function argument names from psql?

On 7/12/06, Timothy Perrigo <tperrigo@wernervas.com> wrote:

Is there a way to get the names of the arguments to a function from
psql? /df and /df+ return the parameter types, but not their names.

select oid::regprocedure from pg_proc where proname like 'your name here';

merlin

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Merlin Moncure (#3)
Re: getting function argument names from psql?

"Merlin Moncure" <mmoncure@gmail.com> writes:

On 7/12/06, Timothy Perrigo <tperrigo@wernervas.com> wrote:

Is there a way to get the names of the arguments to a function from
psql? /df and /df+ return the parameter types, but not their names.

select oid::regprocedure from pg_proc where proname like 'your name here';

Nope, because regprocedureout doesn't include argument names (nor modes).
I think the best way ATM is to look directly at pg_proc.proargnames :-(

regards, tom lane

#5David Fetter
david@fetter.org
In reply to: Tom Lane (#4)
Re: getting function argument names from psql?

On Wed, Jul 12, 2006 at 11:37:04PM -0400, Tom Lane wrote:

"Merlin Moncure" <mmoncure@gmail.com> writes:

On 7/12/06, Timothy Perrigo <tperrigo@wernervas.com> wrote:

Is there a way to get the names of the arguments to a function
from psql? /df and /df+ return the parameter types, but not
their names.

select oid::regprocedure from pg_proc where proname like 'your
name here';

Nope, because regprocedureout doesn't include argument names (nor
modes). I think the best way ATM is to look directly at
pg_proc.proargnames :-(

Back when, I submitted a psql patch to get the input names along with
their types. Shall I dig up that code this weekend?

Cheers,
D
--
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

#6Merlin Moncure
mmoncure@gmail.com
In reply to: David Fetter (#5)
Re: getting function argument names from psql?

On 7/13/06, David Fetter <david@fetter.org> wrote:

On Wed, Jul 12, 2006 at 11:37:04PM -0400, Tom Lane wrote:

select oid::regprocedure from pg_proc where proname like 'your
name here';

Nope, because regprocedureout doesn't include argument names (nor
modes). I think the best way ATM is to look directly at
pg_proc.proargnames :-(

whoop! misread it :)

Back when, I submitted a psql patch to get the input names along with
their types. Shall I dig up that code this weekend?

that would be great, although is there any concern about backwards
compatibility of regprocedure cast? would it be safer to make a new
cast? also, does your patch account for in/out?

merlin

#7David Fetter
david@fetter.org
In reply to: Merlin Moncure (#6)
Re: getting function argument names from psql?

On Thu, Jul 13, 2006 at 09:22:56AM -0400, Merlin Moncure wrote:

On 7/13/06, David Fetter <david@fetter.org> wrote:

On Wed, Jul 12, 2006 at 11:37:04PM -0400, Tom Lane wrote:

Back when, I submitted a psql patch to get the input names along
with their types. Shall I dig up that code this weekend?

that would be great, although is there any concern about backwards
compatibility of regprocedure cast?

I'm not really concerned with any backwards compatibility for this new
feature, as psql has never attempted it for backslash commands.

would it be safer to make a new cast? also, does your patch account
for in/out?

If it didn't, it will. :)

Cheers,
D
--
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

#8Peter Eisentraut
peter_e@gmx.net
In reply to: David Fetter (#5)
Re: getting function argument names from psql?

Am Donnerstag, 13. Juli 2006 15:16 schrieb David Fetter:

Back when, I submitted a psql patch to get the input names along with
their types. Shall I dig up that code this weekend?

Seems reasonable, as long as it doesn't make the output an extra three screens
wide.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#9David Fetter
david@fetter.org
In reply to: Peter Eisentraut (#8)
Re: getting function argument names from psql?

On Thu, Jul 13, 2006 at 03:39:34PM +0200, Peter Eisentraut wrote:

Am Donnerstag, 13. Juli 2006 15:16 schrieb David Fetter:

Back when, I submitted a psql patch to get the input names along
with their types. Shall I dig up that code this weekend?

Seems reasonable, as long as it doesn't make the output an extra
three screens wide.

I can't guarantee that people haven't given their input parameters
names like supercalifragilisticexpialidocious_input_01. I could try
something that would wrap in such cases, but that's a lot more code.
Should I try something that wraps?

Cheers,
D
--
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!