Re: CREATE OR REPLACE FUNCTION
От | Bruce Momjian |
---|---|
Тема | Re: CREATE OR REPLACE FUNCTION |
Дата | |
Msg-id | 200109221424.f8MEOmL08996@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: CREATE OR REPLACE FUNCTION (Gavin Sherry <swm@linuxworld.com.au>) |
Ответы |
Re: CREATE OR REPLACE FUNCTION
|
Список | pgsql-patches |
> On Sat, 22 Sep 2001, Bruce Momjian wrote: > > [snip] > > > 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@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
В списке pgsql-patches по дате отправления: