Re: rules: evaluate inputs in advance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Markus Schiltknecht <markus(at)bluegap(dot)ch>, pgsql-general(at)postgresql(dot)org
Subject: Re: rules: evaluate inputs in advance
Date: 2006-05-14 16:23:33
Message-ID: 14284.1147623813@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)org> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-05-14 16:26:39 Re: Cygwin psql with Windows native Postgres
Previous Message Jaime Casanova 2006-05-14 16:10:00 Re: Diferences between functions criated in pg 8.0.4 and criated in pg 7.4.8