1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Fix places that were using IsTransactionBlock() as an (inadequate) check

that they'd get to commit immediately on finishing.  There's now a
centralized routine PreventTransactionChain() that implements the
necessary tests.
This commit is contained in:
Tom Lane
2002-10-21 22:06:20 +00:00
parent f724c164d3
commit 200b151615
9 changed files with 107 additions and 87 deletions

View File

@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.242 2002/10/19 20:15:09 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.243 2002/10/21 22:06:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -177,12 +177,8 @@ vacuum(VacuumStmt *vacstmt)
* user's transaction too, which would certainly not be the desired
* behavior.
*/
if (vacstmt->vacuum && IsTransactionBlock())
elog(ERROR, "%s cannot run inside a BEGIN/END block", stmttype);
/* Running VACUUM from a function would free the function context */
if (vacstmt->vacuum && !MemoryContextContains(QueryContext, vacstmt))
elog(ERROR, "%s cannot be executed from a function", stmttype);
if (vacstmt->vacuum)
PreventTransactionChain((void *) vacstmt, stmttype);
/*
* Send info about dead objects to the statistics collector