At 21:28 31/07/2004 -0400, Tom Lane wrote:
>>> Now my questions are:
>>> - Is this an expected behavior ?
> It is. Rules are essentially macros and so you have all the usual
> potential gotchas with multiple evaluations of their input arguments.
I've understood what was done by the evaluation process. I was just
expecting that the "NEW" variable would contain the inserted values (after
all it contains correct values for non-sequence columns).
> The recommended way to handle this type of problem is with a trigger
> rather than a rule.
I've changed this operation into a trigger, and it works like a charm. The
function receives the correct values, even the oid (which "rule" doesn't
provide).
I've since modified my queries to use the unified table, and I've gained
approx. 25-35% of execution time. Interesting on an admin page that takes
seconds to generate (hundreds of table lookups).
Thanks for your help.
--
Marc