Statement Triggers and access to other rows in the transaction

Поиск
Список
Период
Сортировка
От Craig Servin
Тема Statement Triggers and access to other rows in the transaction
Дата
Msg-id 200611011050.33562.cservin@cromagnon.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: record datatype comparisons
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: record datatype comparisons