Re: Support for %TYPE in CREATE FUNCTION - Mailing list pgsql-hackers

From Michael Samuel
Subject Re: Support for %TYPE in CREATE FUNCTION
Date
Msg-id 20010531140457.A2407@miknet.net
Whole thread Raw
In response to Re: Support for %TYPE in CREATE FUNCTION  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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>


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Imperfect solutions
Next
From: "Christopher Kings-Lynne"
Date:
Subject: RE: Imperfect solutions