Re: After insert trigger question

From: Stephane Bortzmeyer <bortzmeyer(at)nic(dot)fr>
To: mmiranda(at)americatel(dot)com(dot)sv
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: After insert trigger question
Date: 2005-04-27 15:24:16
Message-ID: 20050427152416.GB4188@nic.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 27, 2005 at 08:45:44AM -0600,
mmiranda(at)americatel(dot)com(dot)sv <mmiranda(at)americatel(dot)com(dot)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"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ned Lilly 2005-04-27 16:04:17 Re: OpenRPT (was Re: [ANNOUNCE] == PostgreSQL Weekly
Previous Message Scott Marlowe 2005-04-27 15:23:19 Re: Reduce size of $PGDATA for "demo cdrom"?