Received: from smtp013.mail.yahoo.com (smtp013.mail.yahoo.com [216.136.173.57]) by postgresql.org (8.11.3/8.11.4) with SMTP id g0NG7tl74530 for ; Wed, 23 Jan 2002 11:08:29 -0500 (EST) (envelope-from janwieck@yahoo.com) Received: from psc.progress.com (HELO saturn.janwieck.net) (192.233.92.200) by smtp.mail.vip.sc5.yahoo.com with SMTP; 23 Jan 2002 16:07:11 -0000 Received: (from wieck@localhost) by saturn.janwieck.net (8.11.2/8.11.2) id g0NG69n14924; Wed, 23 Jan 2002 11:06:09 -0500 From: Jan Wieck Message-Id: <200201231606.g0NG69n14924@saturn.janwieck.net> Subject: Re: ERROR (Bug?) in RULE processing ? In-Reply-To: <3C4ECC12.A78DCE45@math.tu-berlin.de> from Fritz Lehmann-Grube at "Jan 23, 2002 03:43:30 pm" To: Fritz Lehmann-Grube Date: Wed, 23 Jan 2002 11:06:09 -0500 (EST) CC: pgsql-sql X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200201/263 X-Sequence-Number: 6347 Fritz Lehmann-Grube wrote: > > Can somebody tell what this errormessage means ? > ERROR: fireRIRrules: failed to remove aggs from qual > > I don't know what "aggs" and "qual" is. The rewrite rule system was not able to combine the given rule into your insert statement, because aggregate clauses (count() here) in the qualification (WHERE ...) are in fact impossible. Your best bet it to implement that with a trigger. Jan > > What I did: > arbeitsdb=# select id,type,subtype,name from documents; > id | type | subtype | name > ----+------+---------+--------------- > 1 | 1 | 5 | motiv_el_01 > 2 | 1 | 1 | def_el_01 > 3 | 2 | 10 | deduc_el_01 > 4 | 2 | 18 | example_el_01 > (4 rows) > > arbeitsdb=# insert into documents(type,subtype,name) > arbeitsdb-# values (2,16,'foo'); > INSERT 55505 1 > arbeitsdb=# delete from documents where oid=55505; > DELETE 1 > 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; > CREATE > arbeitsdb=# insert into documents(type,subtype,name) > arbeitsdb-# values (2,16,'foo'); > ERROR: fireRIRrules: failed to remove aggs from qual > > Thanks Fritz > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com