Re: background triggers? - Mailing list pgsql-general

From Thomas Hallgren
Subject Re: background triggers?
Date
Msg-id e53j9u$9ed$1@sea.gmane.org
Whole thread Raw
In response to Re: background triggers?  (Sim Zacks <sim@compulab.co.il>)
List pgsql-general
Sim Zacks wrote:
> If the database supported background triggers, it might be implemented
> by a daemon or by the Listen/Notify framework, but I really couldn't
> care less. It is part of the database.
 >
Assume the backend would handle this, what would the transaction semantics look like? You
can't wait for the background work to complete before you commit your transaction, so what
should happen when the background "trigger" fails? Or what if a number of such triggers
where fired and then rolled back?

The only thing the database *can* do, is what it does today. It provides the hooks needed
for specialized code that can react on the *outcome* of transactions (and then perform its
task asynchronously using transactions that are autonomous to the first one).

What you're trying to do doesn't belong in triggers and the concept of "background triggers"
doesn't make any sense. Triggers execute (and complete) within a transaction and the work
they perform should be rolled back if the transaction is rolled back.

Kind regards,
Thomas Hallgren


pgsql-general by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: 8.1 on gentoo
Next
From: Rafal Pietrak
Date:
Subject: Re: background triggers?