Re: Changing a trigger function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Changing a trigger function
Date: 2008-04-24 15:39:40
Message-ID: 29319.1209051580@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> writes:
> am Thu, dem 24.04.2008, um 11:08:12 +0200 mailte Didier Gasser-Morlay folgendes:
>> What would happen if someone sends an update firing that trigger
>> whilst I am in the middle of updating it via a create or update ? Do
>> I need to wait for this evening or can I safely runs the update of the
>> function ?

> All works within a TRANSACTION. If you change the function while the old
> version are running for an other transaction, the other transaction has
> the old version until the end.

Actually I believe that stuff works on SnapshotNow, meaning that the new
definition will be absorbed at the next call of the function after you
commit the CREATE OR REPLACE FUNCTION command. Existing active calls
will continue to use the old function definition till they finish.

For plpgsql functions, there were some bugs in this in 8.1.0-8.1.6
and 8.2.0-8.2.1, so there's some risk of a problem if you're running one
of those versions.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Didier Gasser-Morlay 2008-04-25 04:59:31 Re: restoring with pg_restore
Previous Message Frank Bax 2008-04-24 13:00:21 Re: restoring with pg_restore