PostgreSQL 7.4beta5 Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Chapter 36. Triggers | Fast Forward | Next |
If you are using the SPI interface to execute SQL commands in your trigger functions written in C (or you are using a different language and execute SQL commands in some way, which internally goes through SPI as well), be sure to read Section 37.4 so that you know which data is visible at which point during the execution of a trigger. For triggers, the most important consequences of the data visibility rules are:
The row being inserted (tg_trigtuple) is not visible to SQL commands executed in a before trigger.
The row being inserted (tg_trigtuple) is visible to SQL commands executed in an after trigger (because it was just inserted).
A just-inserted row is visible to all SQL commands executed within any trigger that is fired later in the execution of the outer command (e.g., for the next row).
The next section contains a demonstration of these rules applied.