From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: CREATE OR REPLACE FUNCTION |
Date: | 2001-09-20 20:09:06 |
Message-ID: | 3278.1001016546@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
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.
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
From | Date | Subject | |
---|---|---|---|
Next Message | Liam Stewart | 2001-09-20 20:24:45 | JDBC test suite patch |
Previous Message | Gavin Sherry | 2001-09-20 13:58:37 | CREATE OR REPLACE FUNCTION |