Re: CREATE OR REPLACE FUNCTION

Поиск
Список
Период
Сортировка
От Ian Lance Taylor
Тема Re: CREATE OR REPLACE FUNCTION
Дата
Msg-id silmj9pok3.fsf@daffy.airs.com
обсуждение исходный текст
Ответ на Re: CREATE OR REPLACE FUNCTION  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Gavin Sherry <swm@linuxworld.com.au> writes:
> > Here's a patch I put together. I thought the Oracle-style 'CREATE OR
> > REPLACE FUNCTION' syntax might be useful to those doing lots of function
> > creation/development. It is against the 7.1.3 source.

> ...

> BTW, I've been assuming that when we got around to providing a
> capability like this, it'd be via an "ALTER FUNCTION" kind of
> statement.  Does anyone have a strong feeling pro or con on whether
> "CREATE OR REPLACE" is a preferable approach?  It doesn't seem to
> fit with the spirit of our other maintenance commands, but maybe
> we should just bow down before the Oracle and do it their way...

ALTER FUNCTION seems strange to me, since the point of CREATE OR
REPLACE FUNCTION really is to create the function.  OR REPLACE is a
convenience feature when loading PL/SQL (or PL/pgSQL) files into the
database: you don't have to add a DROP FUNCTION command before each
CREATE FUNCTION command, and you don't have to look at all the
comments or warnings about dropping functions.

We actually have an implementation of CREATE OR REPLACE FUNCTION at
Zembu which I've never bothered rolling up and sending in.  It simply
drops the function first.

Ian

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: CREATE OR REPLACE FUNCTION
Следующее
От: Marko Kreen
Дата:
Сообщение: pgcrypto update