Re: CREATE OR REPLACE FUNCTION

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: CREATE OR REPLACE FUNCTION
Дата
Msg-id 3278.1001016546@sss.pgh.pa.us
обсуждение исходный текст
Ответ на CREATE OR REPLACE FUNCTION  (Gavin Sherry <swm@linuxworld.com.au>)
Ответы Re: CREATE OR REPLACE FUNCTION  (Ian Lance Taylor <ian@airs.com>)
Re: CREATE OR REPLACE FUNCTION  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: CREATE OR REPLACE FUNCTION  (Gavin Sherry <swm@linuxworld.com.au>)
Список pgsql-patches
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.

Hmm.  There are a couple of things that are a tad ugly about this patch
--- you should be heap_update'ing the pg_proc entry, not doing a delete
and insert --- but the main thing I don't like is that there's no
checking to ensure that the function return type doesn't change.  We
can't allow that; it'd break stored views etc that use the function.

It'd probably also be a good idea to insist that the replacer be the
same as the original owner.  (Possibly RemoveFunction does that for you
in the patch as it stands, but it'll need an explicit test if you go
the update route.)

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...

            regards, tom lane

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

Предыдущее
От: Gavin Sherry
Дата:
Сообщение: CREATE OR REPLACE FUNCTION
Следующее
От: Ian Lance Taylor
Дата:
Сообщение: Re: CREATE OR REPLACE FUNCTION