]> granicus.if.org Git - postgresql/commitdiff
Fix for rules system from Jan.
authorBruce Momjian <bruce@momjian.us>
Tue, 20 Oct 1998 17:21:44 +0000 (17:21 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 20 Oct 1998 17:21:44 +0000 (17:21 +0000)
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c

index a59105047cd2fcf36e6cf2ec455ac9a74538e5ef..a0f30698abc6e42b398be087a4f2a585c0e25bf8 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.23 1998/10/02 21:53:39 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.24 1998/10/20 17:21:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1789,11 +1789,11 @@ apply_RIR_view(Node **nodePtr, int rt_index, RangeTblEntry *rte, List *tlist, in
                                                return;
                                        }
 
+                                       exp = copyObject(exp);
                                        if (var->varlevelsup > 0 &&
                                                        nodeTag(exp) == T_Var) {
-                                               exp = copyObject(exp);
                                                ((Var *)exp)->varlevelsup = var->varlevelsup;
-                                       }
+                                       } 
                                        *nodePtr = exp;
                                        *modified = TRUE;
                                }
index 25c1a7f7cbc9b28a47682d4538f039f0558bdd53..d589943dc5c6bc2cdc7475d4e0557a529fa1236d 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.20 1998/10/08 18:29:52 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.21 1998/10/20 17:21:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -418,14 +418,15 @@ ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr,
                                        {
                                                if (info->event == CMD_UPDATE)
                                                {
-                                                       ((Var *) node)->varno = info->current_varno;
-                                                       ((Var *) node)->varnoold = info->current_varno;
+                                                       *nodePtr = n = copyObject(node);
+                                                       ((Var *) n)->varno = info->current_varno;
+                                                       ((Var *) n)->varnoold = info->current_varno;
                                                }
                                                else
                                                        *nodePtr = make_null(((Var *) node)->vartype);
                                        }
                                        else
-                                               *nodePtr = n;
+                                               *nodePtr = copyObject(n);
                                }
                                break;
                        }