Commit 41accb0e authored by Tom Lane's avatar Tom Lane

Fix another place that assumed 'x = lcons(y, z)' would not have any

side-effect on the original list z.  I fear we have a few more of these
to track down yet :-(.
parent f54b9565
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.136 2004/05/26 04:41:33 neilc Exp $ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.137 2004/05/29 05:55:13 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -864,7 +864,6 @@ fireRIRrules(Query *parsetree, List *activeRIRs) ...@@ -864,7 +864,6 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
*/ */
if (locks != NIL) if (locks != NIL)
{ {
List *newActiveRIRs;
ListCell *l; ListCell *l;
if (oidMember(RelationGetRelid(rel), activeRIRs)) if (oidMember(RelationGetRelid(rel), activeRIRs))
...@@ -872,7 +871,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs) ...@@ -872,7 +871,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION), (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("infinite recursion detected in rules for relation \"%s\"", errmsg("infinite recursion detected in rules for relation \"%s\"",
RelationGetRelationName(rel)))); RelationGetRelationName(rel))));
newActiveRIRs = lconso(RelationGetRelid(rel), activeRIRs); activeRIRs = lconso(RelationGetRelid(rel), activeRIRs);
foreach(l, locks) foreach(l, locks)
{ {
...@@ -884,8 +883,10 @@ fireRIRrules(Query *parsetree, List *activeRIRs) ...@@ -884,8 +883,10 @@ fireRIRrules(Query *parsetree, List *activeRIRs)
rule->attrno == -1, rule->attrno == -1,
rel, rel,
relIsUsed, relIsUsed,
newActiveRIRs); activeRIRs);
} }
activeRIRs = list_delete_first(activeRIRs);
} }
heap_close(rel, NoLock); heap_close(rel, NoLock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment