Re: Support for %TYPE in CREATE FUNCTION
Michael Samuel <michael@miknet.net>
From: Michael Samuel <michael@miknet.net>
To: pgsql-hackers@postgresql.org
Date: 2001-05-31T04:04:57Z
Lists: pgsql-hackers
On Wed, May 30, 2001 at 12:30:23PM -0400, Tom Lane wrote: > Actually that's the least of the issues. The real problem is that > because of function overloading, myfunc(int4) and myfunc(int2) (for > example) are considered completely different functions. It is thus > not at all clear what should happen if I create myfunc(foo.f1%TYPE) > and later alter the type of foo.f1 from int4 to int2. Does myfunc(int4) > stop existing? What if a conflicting myfunc(int2) already exists? > What happens to type-specific references to myfunc(int4) --- for > example, what if it's used as the implementation function for an > operator declared on int4? Would the idea of %TYPE being considered a "default" type, so it won't conflict with any more specific functions be out of the question? For example, if I call myfunc(int4), it'll first check if there's a myfunc(int4), then failing that, check if there's a myfunc(foo.bar%TYPE). Umm.. of course, there's no reason why it should search in that order, because checking for myfunc(foo.bar%TYPE) first would be just as valid, but either way, it's a well defined semantic. -- Michael Samuel <michael@miknet.net>