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

From Tom Lane
Subject Re: Support for %TYPE in CREATE FUNCTION
Date
Msg-id 22155.991240223@sss.pgh.pa.us
Whole thread Raw
In response to Re: Support for %TYPE in CREATE FUNCTION  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Support for %TYPE in CREATE FUNCTION  (Don Baccus <dhogaza@pacifier.com>)
Re: Support for %TYPE in CREATE FUNCTION  (Michael Samuel <michael@miknet.net>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I think the major problem was that our pg_proc table doesn't have any
> way of handling arg changes.  In fact, we need a ALTER FUNCTION
> capability first so we can recreate functions in place with the same
> OID.

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?

Worrying about implementation issues is premature when you haven't
got an adequate definition.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Proceeding with gettext
Next
From: Bruce Momjian
Date:
Subject: Re: Support for %TYPE in CREATE FUNCTION