Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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

pgsql-novice by date

Next:From: Didier Gasser-MorlayDate: 2008-04-25 04:59:31
Subject: Re: restoring with pg_restore
Previous:From: Frank BaxDate: 2008-04-24 13:00:21
Subject: Re: restoring with pg_restore

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group