Martijn van Oosterhout <kleptog@xxxxxxxxx> writes: > 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> ) I think it'd be a mistake to assume that WITH would fix Markus' complaint. I haven't studied the spec in detail but I think that WITH acts largely like a macro too. It certainly doesn't have the behavior of "evaluate this just once", as one of the prime uses for it is in recursive query definition. regards, tom lane