Re: ERROR (Bug?) in RULE processing ?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fritz Lehmann-Grube <lehmannf(at)math(dot)TU-Berlin(dot)DE>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: ERROR (Bug?) in RULE processing ?
Date: 2002-03-08 01:29:49
Message-ID: 200203080129.g281Top00972@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I see the query:

arbeitsdb=# CREATE RULE doc_contained AS ON INSERT TO documents WHERE
arbeitsdb-# ((NEW.type = 1) AND (count( (SELECT element_id
arbeitsdb(# 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(at)math(dot)TU-Berlin(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-03-08 02:31:31 Re: psql question
Previous Message Josh Berkus 2002-03-08 01:28:24 Re: [NOVICE] Bad Query?? Extremely slow response