Re: [SQL] Rules aren't doing what I expect

2000-08-11 Thread Mark Volpe
Tom Lane wrote: > > Queries added by non-INSTEAD rules are always performed before the > initially-given query, so you're right, the rule will see the unmodified > value. > > I'd suggest folding the log-entry-making into your trigger, actually. > If you have a trigger anyway then the insert into

Re: [SQL] Rules aren't doing what I expect

2000-08-11 Thread Tom Lane
Mark Volpe <[EMAIL PROTECTED]> writes: > When I try this out, however, the rule seems to use the original > value, rather than the "corrected" value. Queries added by non-INSTEAD rules are always performed before the initially-given query, so you're right, the rule will see the unmodified value.

Re: [SQL] Rules aren't doing what I expect

2000-08-10 Thread Mark Volpe
The actual trigger function I'm working with is over two screens long and rather expensive to be calling twice! Perhaps I need to add another trigger that updates the log table with the correct values after the fact. Recursive triggers, fun! Thanks for the help, Mark Ang Chin Han wrote: > > Eit

Re: [SQL] Rules aren't doing what I expect

2000-08-09 Thread Ang Chin Han
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

[SQL] Rules aren't doing what I expect

2000-08-09 Thread Mark Volpe
Hi again, I have a table with a trigger that can potentially modify a row before it gets inserted or updated: CREATE TABLE t1 (a int); CREATE FUNCTION t1_validate() RETURNS opaque AS ' BEGIN IF (NEW.a>10) THEN NEW.a=10; END IF;