Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35]) by postgresql.org (Postfix) with ESMTP id E189D4760A9 for ; Thu, 7 Mar 2002 20:31:13 -0500 (EST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g281Top00972; Thu, 7 Mar 2002 20:29:50 -0500 (EST) From: Bruce Momjian Message-Id: <200203080129.g281Top00972@candle.pha.pa.us> Subject: Re: ERROR (Bug?) in RULE processing ? In-Reply-To: <2799.1011801628@sss.pgh.pa.us> To: Tom Lane Date: Thu, 7 Mar 2002 20:29:49 -0500 (EST) Cc: Fritz Lehmann-Grube , pgsql-sql X-Mailer: ELM [version 2.4ME+ PL96 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200203/95 X-Sequence-Number: 6976 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 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, Pennsylvania 19026