> On Sat, 22 Sep 2001, Bruce Momjian wrote:
> > I assume it preserves the function's OID? That is something we have
> > needed for a while because it would keep oid references to the function
> > the same, or at least we should give people the option of keeping the
> > oid.
> Yes. The idea is that the oid is preserved. I have assumed that people
> would always want it to be if they were replacing the function. Would
> there be a time when someone wouldn't want to do this? It would be pretty
> simple to update the patch to handle a syntax which specified that a new
> oid should be generated.
Agreed. I think they always want the OID preserved. If they want a new
one, they can drop/create.
You have a good point about REPLACE allowing CREATE/ALTER depending on
whether it already exists, but I see no reason to add this capability
if it requires adding a new toplevel keyword. We already have tons of
them. You could hack ALTER FUNCTION to create automatically if it
doesn't exist, and throw a message to the user if you create it.
However, if we decide we want REPLACE TABLE, etc then I think the
REPLACE FUNCTION would be a good idea. People have asked for this
capability and we have said, "Just drop the table first and ignore the
error if it doesn't exist." The special case here is that the
REPLACE/ALTER FUNCTION preserves the OID, which gives it a special
capability not appropriate for the other objects.
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
In response to
pgsql-patches by date
|Next:||From: Tom Lane||Date: 2001-09-22 15:37:17|
|Subject: Re: CREATE OR REPLACE FUNCTION |
|Previous:||From: Gavin Sherry||Date: 2001-09-22 11:59:40|
|Subject: Re: CREATE OR REPLACE FUNCTION|