From: | Craig Servin <cservin(at)cromagnon(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Statement Triggers and access to other rows in the transaction |
Date: | 2006-11-01 16:50:33 |
Message-ID: | 200611011050.33562.cservin@cromagnon.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Volkan YAZICI | 2006-11-01 21:00:04 | Re: record datatype comparisons |
Previous Message | Chuck McDevitt | 2006-11-01 16:31:30 | Re: [HACKERS] Case Preservation disregarding case |