Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: background triggers?


  • From: Thomas Hallgren <thomas(at)tada(dot)se>
  • To: pgsql-general(at)postgresql(dot)org
  • Subject: Re: background triggers?
  • Date: Thu, 25 May 2006 08:36:46 +0200
  • Message-id: <e53j9u$9ed$1(at)sea(dot)gmane(dot)org>

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





Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group