PostgreSQL 7.4beta4 Documentation
Prev | Fast Backward | Chapter 36. Triggers | Fast Forward | Next

# 36.3. Visibility of Data Changes

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.

Prev | Home | Next
Interaction with the Trigger Manager | Up | A Complete Example