Re: Support for %TYPE in CREATE FUNCTION

From: Michael Samuel <michael(at)miknet(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Support for %TYPE in CREATE FUNCTION
Date: 2001-05-31 04:04:57
Message-ID: 20010531140457.A2407@miknet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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(at)miknet(dot)net>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-05-31 04:12:38 RE: Imperfect solutions
Previous Message Bruce Momjian 2001-05-31 03:42:16 Imperfect solutions

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-05-31 11:03:06 DROP CONSTRAINT (UNIQUE) preliminary support
Previous Message Bruce Momjian 2001-05-31 01:29:32 Re: Patch to remove sort files, temp tables, unreferenced files