pg_get_functiondef and overloaded functions

View: New views
3 Messages — Rating Filter:   Alert me  

pg_get_functiondef and overloaded functions

by tkellerer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm playing around with the new pg_get_functiondef() function but I can't get it to work when I need to specify the argument list.

select pg_get_functiondef('foo'::regproc)

works without problems.

However if I have e.g. foo(int) and foo(int, int) I can't get this to work.

I tried

select pg_get_functiondef('foo(int)'::regproc)
select pg_get_functiondef('foo(int4)'::regproc)
select pg_get_functiondef('foo(integer)'::regproc)

but each time I get the error: function "foo(integer)" does not exist  

What am I missing?

Regards
Thomas


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

Re: pg_get_functiondef and overloaded functions

by Tom Lane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Kellerer <spam_eater@...> writes:
> I tried
> select pg_get_functiondef('foo(int)'::regproc)
> select pg_get_functiondef('foo(int4)'::regproc)
> select pg_get_functiondef('foo(integer)'::regproc)
> but each time I get the error: function "foo(integer)" does not exist  
> What am I missing?

You need to use regprocedure.  regproc is mainly for bootstrap purposes
--- it accepts a function name only.

                        regards, tom lane

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

Re: pg_get_functiondef and overloaded functions

by tkellerer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tom Lane wrote on 30.10.2009 05:44:
>> select pg_get_functiondef('foo(int)'::regproc)
>> select pg_get_functiondef('foo(int4)'::regproc)
>> select pg_get_functiondef('foo(integer)'::regproc)
>> but each time I get the error: function "foo(integer)" does not exist  
>> What am I missing?
>
> You need to use regprocedure.  regproc is mainly for bootstrap purposes
> --- it accepts a function name only.
>

Thanks, works fine.

Where would I find a documentation of all those types?
The section about pg_get_functiondef (and others) doesn't mention this.

Regards
Thomas


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