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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: Changing a trigger function


  • From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • To: "A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
  • Cc: pgsql-novice(at)postgresql(dot)org
  • Subject: Re: Changing a trigger function
  • Date: Thu, 24 Apr 2008 11:39:40 -0400
  • Message-id: <29319.1209051580@sss.pgh.pa.us> <text/plain>

"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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group