On Sun, May 14, 2006 at 08:01:39AM +0200, Markus Schiltknecht wrote: > > What you probably want is a function that is given the row and then > > executes the two statements on a per row basis. This has the effect you > > want but gives up the major benefit of rules, wholesale query > > restructuring like views which allows the executor to find better > > plans. The executor can't see inside a trigger so it can't optimise. > > Isn't that an argument for keeping rewrite rules instead of using > something trigger like for updatable views? Wouldn't it be feasible to > teach the executor how to handle multiple queries with some > pre-evaluated input?
Well, I notice that the SQL standard defines something called WITH, so what you want is something like: WITH OLD AS ( SELECT blah ) DO ( UPDATE <rule1> ; DELETE <rule2> ) The standard doesn't allow you apply one WITH clause to two statements but that is what you want. The implementation though would be, well, difficult... Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to > litigate.
signature.asc
Description: Digital signature