views:

26

answers:

1

I'm working on PostgreSQL 8.4 in read committed mode. I know that for each query, the server makes a snapshot of db state so that the query behaves consistently. Does it include triggers that are called in response to this query? Or is there a new snapshot created for each query called from within a trigger?

+1  A: 

Triggers work in the same transaction as the outer query, it will see the same snapshot.

Frank Heikens
I know they are in the same transaction but the transaction is read committed. So i'm not so sure about the snapshot. Do you know if it's documented somewhere?
stach
Read committed sees all information that is committed by other transactions. Also when this information is committed after your transaction has started, that's why it's called "read committed". Information inserted/updated/deleted inside your own transaction, is alwsay visible for your own transaction. See also http://www.postgresql.org/docs/current/static/transaction-iso.html
Frank Heikens