Re: CREATE OR REPLACE FUNCTION
От | Bruce Momjian |
---|---|
Тема | Re: CREATE OR REPLACE FUNCTION |
Дата | |
Msg-id | 200109221552.f8MFqDn16474@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: CREATE OR REPLACE FUNCTION (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-patches |
> Bruce Momjian <pgman@candle.pha.pa.us> writes: > > ... I see no reason to add this capability > > if it requires adding a new toplevel keyword. > > That kind of annoys me too, but since the keyword can be made a TokenId, > it won't create any conflicts. I think the argument of Oracle > compatibility is probably a sufficient reason to do it with this syntax. I just hate to add another psql help item and manual page for a REPLACE FUNCTION. It seems to asymetrical. Again, if we go all out and allow REPLACE for other items, it would be a big win. In fact, I can see a REPLACE TYPE/OPERATOR, but again ALTER would work for that too. > > You could hack ALTER FUNCTION to create automatically if it > > doesn't exist, > > That's considerably uglier than this alternative, wouldn't you say? > We have no other ALTER commands that work that way. Yes but that is assuming we want the ability to CREATE or ALTER in one command, which I am not sure we need. Just CREATE to create it and ALTER to replace it. We could use CARLETAETRE as C-R-E-A-T-E and A-L-T-E-R mixed. :-) Our stuff is different enough that I am not sure REPLACE has much validity. However, we could allow REPLACE FUNCTION to behave as ALTER FUNCTION and not advertize it so it would be used only for Oracle compatibility. OK, how about this. We do CREATE/ALTER FUNCTION and allow REPLACE to do CREATE/ALTER FUNCTION as needed. That way, we allow a specific way to alter a function that _will_ _fail_ if the function doesn't exist. And we add REPLACE TABLE to do that same where it drops and recreates the table if it already exists. People have asked for that in the past and we have told them to DROP and ignore the result. Seems this would be a nice win and be symetrical for all objects. And it gets us Oracle compatibility. (It would be nice for USER/INDEX/VIEW/SEQUENCE and the others too.) -- 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 по дате отправления: