Re: After insert trigger question - Mailing list pgsql-general

From Stephane Bortzmeyer
Subject Re: After insert trigger question
Date
Msg-id 20050427152416.GB4188@nic.fr
Whole thread Raw
In response to After insert trigger question  (mmiranda@americatel.com.sv)
Responses Re: After insert trigger question
List pgsql-general
On Wed, Apr 27, 2005 at 08:45:44AM -0600,
 mmiranda@americatel.com.sv <mmiranda@americatel.com.sv> wrote
 a message of 21 lines which said:

> I am concerned about how reliable is an before insert trigger, i
> made some computation in my trigger and i want that no matter what
> happens inside the trigger (exceptions, erros, divide by zero, etc)
> , the row must be inserted,

I do not think that pl/pgsql has exception handlers
(http://www.postgresql.org/docs/7.4/interactive/plpgsql-errors-and-messages.html). You
can raise exceptions but not catch them. Could you rewrite your
trigger function with another programming language? In Python, it
would be something like (not tested):

try:
   ... your computations
finally:
   # Insert anyway
   return "OK"

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Reduce size of $PGDATA for "demo cdrom"?
Next
From: Michael Fuhr
Date:
Subject: Re: After insert trigger question