Trigger Question

From: Terry Lee Tucker <terry(at)esc1(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Trigger Question
Date: 2004-12-02 17:00:20
Message-ID: 200412021200.20373.terry@esc1.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello:

I am in the process of converting trigger code written in Progress 4GL to
PostgreSQL triggers written in pl/pgsql. I have some Progress code in a
delete trigger that fires on the deletion of a money line item. In Progress,
I was setting the amount column to 0 in the delete trigger, which, in the
Progress world, caused one of the write triggers to fire before the delete
occured. The code to adjust balances in several places was already
implemented in that write trigger, so setting the amount to zero in the
delete trigger worked nicely; however, PostgreSQL doesn't behave that way.
I'm setting old.amount to zero in a BEFORE DELETE trigger, but it doesn't do
anything in terms of firing another trigger that operates directly on amount
during an update operation. I can work around this so the focus of my
question is this: What would be the circumstances in which you would want to
have a trigger that fires BEFORE the delete as opposed to AFTER the delete? I
searched the documentation but didn't find anything that discussed the
differences between the two trigger types; that is, before and after delete
triggers.

Thanks for any input you can give...
--
Work: 1-336-372-6812
Cell: 1-336-363-4719
email: terry(at)esc1(dot)com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Terry Lee Tucker 2004-12-02 17:12:37 Re: Books
Previous Message BRN Sarma 2004-12-02 14:18:16 implementing tree structure