Re: add parameter to existing function

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Peter Kroon <plakroon(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: add parameter to existing function
Date: 2013-12-10 15:03:42
Message-ID: CAHyXU0ySC2o+gyoBt_Lfjja2+bMZC_gdFMZne=xdLM5mm5pXxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 10, 2013 at 8:26 AM, Peter Kroon <plakroon(at)gmail(dot)com> wrote:
> Hi,
>
> I can use: create or replace function etc....
> to alter a function.
>
> However, this will create a new function instead of replacing the old one
> when adding a parameter.
> Is this possible without the use of DROP and CASCADE?

nope! Changing input or output arguments what identifies a function
basically as in any overloaded language. Imagine if you had inlined
that function call into a view. How would that view be adjusted?

The way to deal with this, as in many things with postgres or database
in general, is to get *out* of the habit of using UI tools to manage
schema structures and get in the habit of maintaining proper schema
scripts, particularly for views in functions. This makes DROP a non
issue: after CASCADE eats your various views or whatever, you then
just have to reapply your view containing script.

merlin

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-12-10 15:21:08 Re: DB Audit
Previous Message Ian Lawrence Barwick 2013-12-10 15:02:04 Re: Q: regarding backends