diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/async.c | 10 | ||||
-rw-r--r-- | src/backend/commands/indexcmds.c | 11 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 26 |
3 files changed, 26 insertions, 21 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 4c7c5f21102..97e1dc17ae2 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.88 2002/08/05 03:29:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.89 2002/08/30 22:18:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -400,9 +400,9 @@ Async_UnlistenOnExit(void) */ AbortOutOfAnyTransaction(); /* Now we can do the unlisten */ - StartTransactionCommand(); + StartTransactionCommand(true); Async_UnlistenAll(); - CommitTransactionCommand(); + CommitTransactionCommand(true); } /* @@ -749,7 +749,7 @@ ProcessIncomingNotify(void) notifyInterruptOccurred = 0; - StartTransactionCommand(); + StartTransactionCommand(true); lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); tdesc = RelationGetDescr(lRel); @@ -803,7 +803,7 @@ ProcessIncomingNotify(void) */ heap_close(lRel, NoLock); - CommitTransactionCommand(); + CommitTransactionCommand(true); /* * Must flush the notify messages to ensure frontend gets them diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index ec7e1482798..b951fccb98c 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.85 2002/08/29 15:56:20 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.86 2002/08/30 22:18:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -735,15 +735,16 @@ ReindexDatabase(const char *dbname, bool force, bool all) heap_close(relationRelation, AccessShareLock); /* Now reindex each rel in a separate transaction */ - CommitTransactionCommand(); + CommitTransactionCommand(true); for (i = 0; i < relcnt; i++) { - StartTransactionCommand(); + StartTransactionCommand(true); if (reindex_relation(relids[i], force)) elog(NOTICE, "relation %u was reindexed", relids[i]); - CommitTransactionCommand(); + CommitTransactionCommand(true); } - StartTransactionCommand(); + /* Tell xact.c not to chain the upcoming commit */ + StartTransactionCommand(true); MemoryContextDelete(private_context); } diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 4fc3b1d3d90..cda893fab75 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.234 2002/08/13 20:14:24 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.235 2002/08/30 22:18:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -273,7 +273,7 @@ vacuum(VacuumStmt *vacstmt) } /* matches the StartTransaction in PostgresMain() */ - CommitTransactionCommand(); + CommitTransactionCommand(true); } /* @@ -296,14 +296,14 @@ vacuum(VacuumStmt *vacstmt) * return (else we leak memory while processing multiple tables). */ if (vacstmt->vacuum) - StartTransactionCommand(); + StartTransactionCommand(true); else old_context = MemoryContextSwitchTo(anl_context); analyze_rel(relid, vacstmt); if (vacstmt->vacuum) - CommitTransactionCommand(); + CommitTransactionCommand(true); else { MemoryContextSwitchTo(old_context); @@ -319,8 +319,12 @@ vacuum(VacuumStmt *vacstmt) { /* here, we are not in a transaction */ - /* matches the CommitTransaction in PostgresMain() */ - StartTransactionCommand(); + /* + * This matches the CommitTransaction waiting for us in PostgresMain(). + * We tell xact.c not to chain the upcoming commit, so that a VACUUM + * doesn't start a transaction block, even when autocommit is off. + */ + StartTransactionCommand(true); /* * If we did a database-wide VACUUM, update the database's pg_database @@ -703,7 +707,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) Oid toast_relid; /* Begin a transaction for vacuuming this relation */ - StartTransactionCommand(); + StartTransactionCommand(true); /* * Check for user-requested abort. Note we want this to be inside a @@ -719,7 +723,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) ObjectIdGetDatum(relid), 0, 0, 0)) { - CommitTransactionCommand(); + CommitTransactionCommand(true); return; } @@ -750,7 +754,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) elog(WARNING, "Skipping \"%s\" --- only table or database owner can VACUUM it", RelationGetRelationName(onerel)); relation_close(onerel, lmode); - CommitTransactionCommand(); + CommitTransactionCommand(true); return; } @@ -763,7 +767,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) elog(WARNING, "Skipping \"%s\" --- can not process indexes, views or special system tables", RelationGetRelationName(onerel)); relation_close(onerel, lmode); - CommitTransactionCommand(); + CommitTransactionCommand(true); return; } @@ -799,7 +803,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) /* * Complete the transaction and free all temporary memory used. */ - CommitTransactionCommand(); + CommitTransactionCommand(true); /* * If the relation has a secondary toast rel, vacuum that too while we |