aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-10-29 22:20:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-10-29 22:20:03 +0000
commit61fbe859857b1a27396f97f2318092d53687788b (patch)
tree210e7cb9c233de70330b2c52ab561bc78cf1a038 /src
parentc23f808eeb0db846c81531ef4194ecb608d883bf (diff)
downloadpostgresql-61fbe859857b1a27396f97f2318092d53687788b.tar.gz
postgresql-61fbe859857b1a27396f97f2318092d53687788b.zip
Rearrange order of pre-commit operations: must close cursors before doing
ON COMMIT actions. Per bug report from Michael Guerin.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xact.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 3409de03a56..266b31e0b3e 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.156.2.1 2004/08/11 04:08:00 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.156.2.2 2004/10/29 22:20:03 tgl Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -917,33 +917,25 @@ CommitTransaction(void)
elog(WARNING, "CommitTransaction and not in in-progress state");
/*
+ * Do pre-commit processing (most of this stuff requires database
+ * access, and in fact could still cause an error...)
+ */
+
+ /*
* Tell the trigger manager that this transaction is about to be
* committed. He'll invoke all trigger deferred until XACT before we
* really start on committing the transaction.
*/
DeferredTriggerEndXact();
- /*
- * Similarly, let ON COMMIT management do its thing before we start to
- * commit.
- */
- PreCommit_on_commit_actions();
-
- /* Prevent cancel/die interrupt while cleaning up */
- HOLD_INTERRUPTS();
-
- /*
- * set the current transaction state information appropriately during
- * the abort processing
- */
- s->state = TRANS_COMMIT;
+ /* Close open cursors */
+ AtCommit_Portals();
/*
- * Do pre-commit processing (most of this stuff requires database
- * access, and in fact could still cause an error...)
+ * Let ON COMMIT management do its thing (must happen after closing
+ * cursors, to avoid dangling-reference problems)
*/
-
- AtCommit_Portals();
+ PreCommit_on_commit_actions();
/* handle commit for large objects [ PA, 7/17/98 ] */
/* XXX probably this does not belong here */
@@ -955,6 +947,15 @@ CommitTransaction(void)
/* Update the flat password file if we changed pg_shadow or pg_group */
AtEOXact_UpdatePasswordFile(true);
+ /* Prevent cancel/die interrupt while cleaning up */
+ HOLD_INTERRUPTS();
+
+ /*
+ * set the current transaction state information appropriately during
+ * the abort processing
+ */
+ s->state = TRANS_COMMIT;
+
/*
* Here is where we really truly commit.
*/