pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_get_functiondef and overloaded functions
3+ messages / 2 participants
[nested] [flat]

* pg_get_functiondef and overloaded functions
@ 2009-10-29 23:12  Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Kellerer @ 2009-10-29 23:12 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_get_functiondef and overloaded functions
@ 2009-10-30 04:44  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2009-10-30 04:44 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-sql

Thomas Kellerer <spam_eater@gmx.net> 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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_get_functiondef and overloaded functions
@ 2009-10-30 23:46  Thomas Kellerer <spam_eater@gmx.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Kellerer @ 2009-10-30 23:46 UTC (permalink / raw)
  To: pgsql-sql

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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2009-10-30 23:46 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-10-29 23:12 pg_get_functiondef and overloaded functions Thomas Kellerer <spam_eater@gmx.net>
2009-10-30 04:44 ` Tom Lane <tgl@sss.pgh.pa.us>
2009-10-30 23:46   ` Thomas Kellerer <spam_eater@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox