Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

Next:From: Christopher Kings-LynneDate: 2001-05-31 04:12:38
Subject: RE: Imperfect solutions
Previous:From: Bruce MomjianDate: 2001-05-31 03:42:16
Subject: Imperfect solutions

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group