Re: Rule problem: return value of insert - Mailing list pgsql-general

From Stephen Friedrich
Subject Re: Rule problem: return value of insert
Date
Msg-id 43CD4FC7.3000005@fortis-it.de
Whole thread Raw
In response to Re: Rule problem: return value of insert  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Rule problem: return value of insert  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Thanks for the quick answer - even though it does not solve my problem  :-(

Tom Lane wrote:
 > Not when you're using a pile of conditional rules like that.  The last
 > one to fire determines the result, so you'll only see a nonzero count
 > when inserting into the last subtable.

Hm, it fails even if I have only a single inherited table.
Also only one rule will 'fire'. Or do you mean that the last rule that
gets evaluated will determine the result, even if it's where clause evaluates
to false?

 > I think you'd be better off to forget the rule approach and instead
 > put a trigger on the parent table that stores the values into the
 > appropriate subtable and then returns NULL.  Unfortunately that won't
 > fix the rowcount problem either (because suppressed inserts won't be
 > counted), but it will certainly outperform a large collection of rules.

Thanks I'll try that. Yet I have only some dozen cdrs at any time, so
I doubt it will make a big difference?


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Rule problem: return value of insert
Next
From: Tino Wildenhain
Date:
Subject: Re: Distance calculation