Обсуждение: getting function argument names from psql?

Поиск
Список
Период
Сортировка

getting function argument names from psql?

От
Timothy Perrigo
Дата:
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

Re: getting function argument names from psql?

От
Michael Fuhr
Дата:
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

Re: getting function argument names from psql?

От
"Merlin Moncure"
Дата:
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

Re: getting function argument names from psql?

От
Tom Lane
Дата:
"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

Re: getting function argument names from psql?

От
David Fetter
Дата:
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!

Re: getting function argument names from psql?

От
"Merlin Moncure"
Дата:
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

Re: getting function argument names from psql?

От
David Fetter
Дата:
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!

Re: getting function argument names from psql?

От
David Fetter
Дата:
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!

Re: getting function argument names from psql?

От
Peter Eisentraut
Дата:
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/