pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedERROR (Bug?) in RULE processing ?
4+ messages / 4 participants
[nested] [flat]
* ERROR (Bug?) in RULE processing ?
@ 2002-01-23 14:43 Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>
0 siblings, 2 replies; 4+ messages in thread
From: Fritz Lehmann-Grube @ 2002-01-23 14:43 UTC (permalink / raw)
To: pgsql-sql
Can somebody tell what this errormessage means ?
ERROR: fireRIRrules: failed to remove aggs from qual
I don't know what "aggs" and "qual" is.
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: ERROR (Bug?) in RULE processing ?
@ 2002-01-23 16:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>
1 sibling, 1 reply; 4+ messages in thread
From: Tom Lane @ 2002-01-23 16:00 UTC (permalink / raw)
To: Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: ERROR (Bug?) in RULE processing ?
@ 2002-01-23 16:06 Jan Wieck <janwieck@yahoo.com>
parent: Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>
1 sibling, 0 replies; 4+ messages in thread
From: Jan Wieck @ 2002-01-23 16:06 UTC (permalink / raw)
To: Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: ERROR (Bug?) in RULE processing ?
@ 2002-03-08 01:29 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 4+ messages in thread
From: Bruce Momjian @ 2002-03-08 01:29 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>; 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@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, Pennsylvania 19026
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-03-08 01:29 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-01-23 14:43 ERROR (Bug?) in RULE processing ? Fritz Lehmann-Grube <lehmannf@math.TU-Berlin.DE>
2002-01-23 16:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-03-08 01:29 ` Bruce Momjian <pgman@candle.pha.pa.us>
2002-01-23 16:06 ` Jan Wieck <janwieck@yahoo.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox