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

Feature Request: ALTER FUNCTION (or something like that)

From: Joel Burton <jburton(at)scw(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Feature Request: ALTER FUNCTION (or something like that)
Date: 2001-03-28 00:38:59
Message-ID: Pine.LNX.4.21.0103271932430.30896-100000@olympus.scw.org (view raw or flat)
Thread:
Lists: pgsql-hackers
(I know that everyone is focusing on 7.1. This is a question about how
hard it would be to plan a feature for 7.2 or later)

One of the small annoyances in PG is that I use many functions to handle
small details, and these functions are called by views. If I want to
improve a function, I have to drop and recreate those views (and all views
that depend on them, etc.)

If I understand everything, this is because the function OID is used to
call the function, not its name.

How difficult would it be to either

. allow creation of a function using a specific OID? (CREATE FUNCTION
USING OID xxxxx ...)

or

. add a command like ALTER FUNCTION foo(text) TO foo(text) returns text as
....

Then, (presumably?) the calling functions and views could just find the
function by its old oid.

This would seem to require that the new function would take the same
parameters (and return the same?) as the old function. This could be
handled either as a runtime check by the ALTER command, or it could be
left as caveat functioner.

Perhaps this is tricky, or perhaps there's already a great solution. (If 
so, please tell!) If I'm making an idiot of myself, do let me know.

Otherwise, is this feasible? I could try my rusty hand at C, but I'd need
someone to give me a 2-paragraph game plan on where to start playing with
the code.

Thanks!


(of course, this raises the same question for VIEWs... dropping and
creating them is a pain b/c of the same reasons...)


-- 
Joel Burton   <jburton(at)scw(dot)org>
Director of Information Systems, Support Center of Washington


Responses

pgsql-hackers by date

Next:From: Mathijs BrandsDate: 2001-03-28 00:40:00
Subject: Re: Re: [BUGS] Tests randomly failed
Previous:From: Tom LaneDate: 2001-03-28 00:38:47
Subject: Re: IANA registration

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