TRIGGER with WHEN clause

From: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: TRIGGER with WHEN clause
Date: 2009-10-22 02:33:10
Message-ID: 20091022111408.2F41.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers

Here is a patch to provide WHEN clause on triggers discussed here:
http://archives.postgresql.org/pgsql-hackers/2009-10/msg00869.php

Of course we can check conditions in the body of triggers, but
there are some benefits to have separate WHEN clause for SQL standard
compliance, portability, and saving AFTER trigger queues.

There might be still incomplete and debatable part in the patch:

* Usages of TupleTableSlot and RangeTblEntry might be ugly.
Please notice me if there are better ways.

* There are no "retry" feature to evaluate condition when
the NEW tuple is modifed by another trigger. Triggers are
still executed in alphabetical order, but it is adjustable.

Comments welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
trigger-when_20091022.patch application/octet-stream 45.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Jantzen 2009-10-22 03:52:59 Reversing flow of WAL shipping
Previous Message Pavel Stehule 2009-10-22 02:19:14 Re: Prelim specs for parser hooks for plpgsql

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message Greg Smith 2009-11-12 17:45:24 CommitFest 2009-11 Call for Reviewers
Previous Message Robert Haas 2009-10-05 23:57:59 Re: Anything I can still do for this CF?