Re: ERROR (Bug?) in RULE processing ? - Mailing list pgsql-sql

From Bruce Momjian
Subject Re: ERROR (Bug?) in RULE processing ?
Date
Msg-id 200203080129.g281Top00972@candle.pha.pa.us
Whole thread Raw
In response to Re: ERROR (Bug?) in RULE processing ?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
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
 


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: [NOVICE] Bad Query?? Extremely slow response
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: psql question