I see the query:
arbeitsdb=# CREATE RULE doc_contained AS ON INSERT TO documents WHEREarbeitsdb-# ((NEW.type = 1) AND (count( (SELECT
element_idarbeitsdb(# FROM element_contained_in WHERE (element_id =currval('docs_seq')) )) = 0))arbeitsdb-# DO INSTEAD
NOTHING;
Added to TODO:
* Prevent aggregates from being used in rule WHERE clauses
Also, please try using HAVING with count() and see if that helps.
---------------------------------------------------------------------------
Tom Lane wrote:
> Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE> writes:
> > Can somebody tell what this errormessage means ?
> > ERROR: fireRIRrules: failed to remove aggs from qual
>
> The reason it's such an unfriendly error message is that it's an
> internal "shouldn't ever happen" check.
>
> What you actually did wrong was to use an aggregate function (count())
> in the rule's WHERE clause. This should have been rejected much further
> upstream, like when you tried to create the rule. That error test
> doesn't seem to be there now though :-(
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026