Statement Triggers and access to other rows in the transaction - Mailing list pgsql-sql

From Craig Servin
Subject Statement Triggers and access to other rows in the transaction
Date
Msg-id 200611011050.33562.cservin@cromagnon.com
Whole thread Raw
List pgsql-sql
I have tables representing a ledger system and the accounts on which it 
operates.

I want to do 2 things to all transactions altering the ledger tables.

First, all of the inserts into the ledger tables should be balanced ( They 
should sum to 0 ).  If not I want to abort the transaction.

Second, if the transaction is balanced I want to update the account balance on 
the account tables.


In other database systems that I have used when you have a statement level 
trigger you get access to the inserted/updated/deleted rows from that 
transaction as "virtual" tables within the trigger that you can manipulate.

I am currently using plpgsql to write my triggers.  I have not been able to 
figure out the "right" way to do this in PostgreSQL and would appreciate any 
advice.


Thanks,

Craig




pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: record datatype comparisons
Next
From: Andrew Sullivan
Date:
Subject: Re: record datatype comparisons