77 * Portions Copyright (c) 1994, Regents of the University of California
88 *
99 * IDENTIFICATION
10- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.136 2004/05/26 04:41:33 neilc Exp $
10+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.137 2004/05/29 05:55:13 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -864,15 +864,14 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
864864 */
865865if (locks != NIL )
866866{
867- List * newActiveRIRs ;
868867ListCell * l ;
869868
870869if (oidMember (RelationGetRelid (rel ),activeRIRs ))
871870ereport (ERROR ,
872871(errcode (ERRCODE_INVALID_OBJECT_DEFINITION ),
873872errmsg ("infinite recursion detected in rules for relation \"%s\"" ,
874873RelationGetRelationName (rel ))));
875- newActiveRIRs = lconso (RelationGetRelid (rel ),activeRIRs );
874+ activeRIRs = lconso (RelationGetRelid (rel ),activeRIRs );
876875
877876foreach (l ,locks )
878877{
@@ -884,8 +883,10 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
884883rule -> attrno == -1 ,
885884rel ,
886885relIsUsed ,
887- newActiveRIRs );
886+ activeRIRs );
888887}
888+
889+ activeRIRs = list_delete_first (activeRIRs );
889890}
890891
891892heap_close (rel ,NoLock );