Re: Transaction commit in a trigger function - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Transaction commit in a trigger function
Date
Msg-id 20070517190342.GO28701@alvh.no-ip.org
Whole thread Raw
In response to Transaction commit in a trigger function  ("Henka" <henka@cityweb.co.za>)
List pgsql-general
Henka wrote:

> Is it possible to (somehow) commit a specific statement in a trigger
> function if the function itself is rolled back because of an error (eg, for a
> unique index error)?

No.  You can use savepoints (or, in PL/pgSQL functions, EXCEPTION
blocks) to inhibit the uniqueness error from aborting the transaction.
There is an example in the error catching section of the PL/pgSQL docs
about the insert-if-fail-update construct.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-general by date:

Previous
From: "Henka"
Date:
Subject: Transaction commit in a trigger function
Next
From: Hannes Dorbath
Date:
Subject: Re: Fault Tolerant Postgresql (two machines, two postmasters, one disk array)