From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to cast to regprocedure with OUT parameters |
Date: | 2014-08-14 15:33:58 |
Message-ID: | 3956.1408030438@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thomas Kellerer <spam_eater(at)gmx(dot)net> writes:
> Hello,
> pg_get_functiondef() can be used quite easily by using a cast to regprocedure, like this:
> select pg_get_functiondef('public.foo(text, text, text)'::regprocedure);
> However if the function is defined with an out parameter like this:
> create or replace function foo(p1 text, p2 out text, p3 text)
> ....
> the above cast does not work. Postgres returns an error: "function public.foo(text,text,text) does not exist.
> 'public.foo(text, OUT text, text)'::regprocedure does not work either.
> So, what should be the right format to write the string literal that can be cast to the correct regprocedure?
Leave out the OUT parameters altogether:
select pg_get_functiondef('public.foo(text, text)'::regprocedure);
Only IN parameters contribute to the function's identity; OUT parameters
are just a variant method of specifying its return type.
Personally I wouldn't randomly mix IN and OUT like that, but put all the
OUT parameters at the end of the list. It seems too confusing otherwise.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Kellerer | 2014-08-14 15:50:24 | Re: How to cast to regprocedure with OUT parameters |
Previous Message | Thomas Kellerer | 2014-08-14 15:13:03 | How to cast to regprocedure with OUT parameters |