Re: Problem with sequence et rule

From: Marc Boucher <achernar(at)gmx(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problem with sequence et rule
Date: 2004-08-01 22:31:05
Message-ID: 3.0.5.32.20040802003105.00802b50@pop.gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2004-08-02 19:35:52 Re: 7.5dev assertion failure w/ v3 protocol and transactions
Previous Message Tom Lane 2004-08-01 01:28:29 Re: Problem with sequence et rule