Hi hackers,
Attached is a patch for supporting queries in the WHEN expression of
statement triggers. It is restricted so that the expression can
reference only the transition tables and the table to which the trigger
is attached. This seemed to make the most sense in that it follows what
you can do in the per row triggers. I did have a look in the standards
document about triggers, and couldn't see any restrictions mentioned,
but nevertheless thought it made most sense.
One possibility controversial aspect is that the patch doesn't use SPI
to evaluate the expression; it constructs a Query instead and passes it
to the executor. Don't know what people's thoughts are on doing that?
-Joe