Re: bug? rules fail to cascade after NOT IN - Mailing list pgsql-hackers

From Tom Lane
Subject Re: bug? rules fail to cascade after NOT IN
Date
Msg-id 19486.1046743228@sss.pgh.pa.us
Whole thread Raw
In response to bug? rules fail to cascade after NOT IN  (Brandon Craig Rhodes <brandon@oit.gatech.edu>)
Responses Re: bug? rules fail to cascade after NOT IN  (Brandon Craig Rhodes <brandon@oit.gatech.edu>)
List pgsql-hackers
Brandon Craig Rhodes <brandon@oit.gatech.edu> writes:
> The `working' test case omits the
>     AND (account, policy) NOT IN
>      (SELECT account, policy FROM policy_accounts_active)
> condition from the end of executor_active, which magically makes the
> executor_hamlet rule start firing as it should.

I don't think this is a bug.  The executor_hamlet rule fires after the
executor_active rule does; therefore the (account, policy) pair *has
already been inserted into policy_accounts_active*, and will be found
when executor_hamlet re-executes the select to look for it.

My advice to you is to use triggers, not rules, for pushing data from
one table to another; especially when you need logic this complex to
decide what to do.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: problem importing languages in CVS tip
Next
From: Brandon Craig Rhodes
Date:
Subject: Re: bug? rules fail to cascade after NOT IN