Jeff Boes <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> No kidding.  A rule is a macro and therefore has the usual risks of
>> multiple evaluations of arguments.

> But shouldn't "new.job_id" use the value that was already recorded in 
> the original row?

There is no "value that was already recorded in the original row";
if you want to think in those terms you should use a trigger.  It's
fundamentally wrong to think of a rule in that way.

In the rule, "new.job_id" is effectively a macro parameter that gets
replaced by the INSERT's corresponding expression, ie, nextval(...).

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to