1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-23 14:01:44 +03:00

Disable VACUUM from being called from a function because function memory

would be cleared by vacuum;  fix idea from Tom Lane.
This commit is contained in:
Bruce Momjian
2002-04-15 23:39:42 +00:00
parent 5b92d004fa
commit 2036b3fc59

View File

@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * 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()) if (IsTransactionBlock())
elog(ERROR, "%s cannot run inside a BEGIN/END block", stmttype); 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 * Send info about dead objects to the statistics collector
*/ */