Re: Rule problem: return value of insert

From: Stephen Friedrich <stephen(dot)friedrich(at)fortis-it(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Rule problem: return value of insert
Date: 2006-01-17 20:12:55
Message-ID: 43CD4FC7.3000005@fortis-it.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2006-01-17 20:19:06 Re: Distance calculation
Previous Message Tom Lane 2006-01-17 20:02:27 Re: Rule problem: return value of insert