On Wed, Jun 26, 2013 at 01:50:46AM -0400, Joshua Burns wrote:
> Example #1:
> -- A stored procedure which can accept two arguments, each of which could
> be text, character varying, character varying(any length) or character(any
> length).
> SELECT * FROM my_fn('val1'::text, 'val2'::character(4));
>
> Example #2:
> -- A stored procedure which can accept two arguments, each of which could
> be smallint, integer, or bigint.
> SELECT * FROM my_fn('1'::smallint, '3726323626326262362'::bigint);
...
> In regards to Examples 1 & 2, I'm at a complete loss.
I suppose you can use function overloading.
Have only the "base" function (that which operates on the
"largest" type, say TEXT/BIGINT) contain the actual code and
write wrappers in the SQL PL (not plpgsql) which accept
other types and cast towards TEXT and BIGINT as needed.
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346