Re: Feature Request: ALTER FUNCTION (or something like that)

From: Joel Burton <jburton(at)scw(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Feature Request: ALTER FUNCTION (or something like that)
Date: 2001-03-28 03:55:45
Message-ID: Pine.LNX.4.21.0103272248240.717-100000@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 27 Mar 2001, Tom Lane wrote:

> Joel Burton <jburton(at)scw(dot)org> writes:
> > . add a command like ALTER FUNCTION foo(text) TO foo(text) returns text as
> > ....
>
> This is on the TODO list already, I believe.

Yikes. I should have read it more carefully. My apologies. There are so
many good things on it. Sadly, no one has claimed this item.

(I still didn't see ALTER VIEW, though, which would seem just as nice.)

> > This would seem to require that the new function would take the same
> > parameters (and return the same?) as the old function.
>
> If it doesn't take the same parameters then it's not the same function
> at all, so that part is a nonissue. We'd have to disallow change of
> return type as well.
>
> > Perhaps this is tricky,
>
> Updating pg_proc wouldn't be hard. What's missing is a notification
> mechanism that would cause cached copies of the function to get
> replaced. A crude first cut could just ignore that issue and still be
> extremely useful for development ...

A crude first cut would be useful for development... even if I had to
restart postmaster, it's still much easier than dumping/restoring the
whole database, which is the usual solution around here (trying to
individually fix each view/table using the function becomes so tricky as
one has to track every dependency after that, etc.) Dumping/restoring can
be great (three cheers especially for the new formats using the -F
switch!), but in the past, I've had one or two complicated views that
would dump, but couldn't be restored from the dump. (As was discussed
at the time in the list; the culprit was that pg_dump produced a
deeply complex expresion with a bazillion nested parentheses; if one
removed some of these, pg_restore did just fine.) This has disappeared
in the 7.1 code, but I'm still slightly skitting about the dump-restore so
very frequently cycle.

If I have your ear on the subject, tgl, is there any ugly-but-working hack
to update the function by modifying the system tables directly?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-03-28 05:00:41 RE: Feature Request: ALTER FUNCTION (or something like that)
Previous Message Mark Knox 2001-03-28 03:45:22 Re: Re: Call for platforms