Re: CREATE OR REPLACE FUNCTION

From: Ian Lance Taylor <ian(at)airs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>, pgsql-patches(at)postgresql(dot)org
Subject: Re: CREATE OR REPLACE FUNCTION
Date: 2001-09-20 20:58:20
Message-ID: silmj9pok3.fsf@daffy.airs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gavin Sherry <swm(at)linuxworld(dot)com(dot)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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Marko Kreen 2001-09-22 01:10:05 pgcrypto update
Previous Message Liam Stewart 2001-09-20 20:24:45 JDBC test suite patch