Re: Rules aren't doing what I expect - Mailing list pgsql-sql

From Ang Chin Han
Subject Re: Rules aren't doing what I expect
Date
Msg-id 20000810101820.A8537@pintoo.com
Whole thread Raw
In response to Rules aren't doing what I expect  (Mark Volpe <volpe.mark@epamail.epa.gov>)
List pgsql-sql
On Wed, Aug 09, 2000 at 12:04:13PM -0400, Mark Volpe wrote:

> I have a table with a trigger that can potentially modify a row before it gets
> inserted or updated:

[snip]

> I have another table that tracks changes in the first table with rules:

AFAIK, rules get rewritten first, before triggers are invoked,
so your rules are getting the values before your trigger changes them.

> The t1_log table doesn't show what was actually inserted into t1!
> Are there any changes I can make to the logic above so that t1_log can
> show the correct value?

Either somehow rewrite your trigger as a rule, or stick another
trigger to change the value before getting into your log table.
You might be able to reuse your trigger function, I think, just
point the trigger to that function. A bit inefficient, since it
gets called twice.


pgsql-sql by date:

Previous
From: Mark Volpe
Date:
Subject: Rules aren't doing what I expect
Next
From: Mark Volpe
Date:
Subject: Re: Rules aren't doing what I expect