Re: Preventing an 'after' trigger from causing rollback on error

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Eliot Gable <egable+pgsql-general(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Preventing an 'after' trigger from causing rollback on error
Date: 2012-04-13 23:56:42
Message-ID: 1334361402.28820.5.camel@sussancws0025
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2012-04-13 at 17:58 -0400, Eliot Gable wrote:
> Is there any way I can stop a trigger which fires after a row is
> inserted into a table from causing a rollback of the entire
> transaction if something goes wrong?

1. Try using subtransactions
( http://www.postgresql.org/docs/9.1/static/sql-savepoint.html ). I
suggest releasing or rolling back the savepoints that you no longer need
because triggers can be executed many times.
2. You could have a separate connection that does the processing you
need, and use LISTEN/NOTIFY to alert the other connection that new data
is available to process.

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2012-04-14 00:06:40 Re: Preventing an 'after' trigger from causing rollback on error
Previous Message Eliot Gable 2012-04-13 21:58:15 Preventing an 'after' trigger from causing rollback on error