From 3513f4d162838c5c33ae89c30eac90b95e154f69 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Fri, 30 Jun 2000 07:06:05 +0000
Subject: [PATCH] RemoveView was doing things the hard way...

---
 src/backend/commands/view.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index cbe87b5e0ed..3b1bfedea23 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *	$Id: view.c,v 1.43 2000/06/12 19:40:40 momjian Exp $
+ *	$Id: view.c,v 1.44 2000/06/30 07:06:05 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -109,7 +109,6 @@ DefineVirtualRelation(char *relname, List *tlist)
  *
  * Given a view name, returns the name for the 'on retrieve to "view"'
  * rule.
- * This routine is called when defining/removing a view.
  *------------------------------------------------------------------
  */
 char *
@@ -293,22 +292,9 @@ DefineView(char *viewName, Query *viewParse)
 void
 RemoveView(char *viewName)
 {
-	char	   *rname;
-
-	/*
-	 * first remove all the "view" rules... Currently we only have one!
-	 */
-	rname = MakeRetrieveViewRuleName(viewName);
-	RemoveRewriteRule(rname);
-
-	/*
-	 * we don't really need that, but just in case...
-	 */
-	CommandCounterIncrement();
-
 	/*
-	 * now remove the relation.
+	 * We just have to drop the relation; the associated rules will
+	 * be cleaned up automatically.
 	 */
 	heap_drop_with_catalog(viewName);
-	pfree(rname);
 }
-- 
GitLab