]> granicus.if.org Git - postgresql/commitdiff
Disable VACUUM from being called from a function because function memory
authorBruce Momjian <bruce@momjian.us>
Mon, 15 Apr 2002 23:39:42 +0000 (23:39 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 15 Apr 2002 23:39:42 +0000 (23:39 +0000)
would be cleared by vacuum;  fix idea from Tom Lane.

src/backend/commands/vacuum.c

index 20a366d02ab39b1f07d180e103ae68553e8b5f02..eaee990c69d85631059f9e27344dbe14c459a0bc 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.223 2002/04/12 20:38:25 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.224 2002/04/15 23:39:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -181,6 +181,10 @@ vacuum(VacuumStmt *vacstmt)
        if (IsTransactionBlock())
                elog(ERROR, "%s cannot run inside a BEGIN/END block", stmttype);
 
+       /* Running VACUUM from a function would free the function context */
+       if (!MemoryContextContains(QueryContext, vacstmt))
+               elog(ERROR, "%s cannot be executed from a function", stmttype);
+                        
        /*
         * Send info about dead objects to the statistics collector
         */