Re: Problem with sequence et rule - Mailing list pgsql-bugs

From Marc Boucher
Subject Re: Problem with sequence et rule
Date
Msg-id 3.0.5.32.20040802003105.00802b50@pop.gmx.net
Whole thread Raw
In response to Re: Problem with sequence et rule  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: liz gonzalez
Date:
Subject: PROBLEMS!!!
Next
From: Bill Hernandez
Date:
Subject: could not create shared memory segment - i386