summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2004-10-29 22:19:53 +0000
committerTom Lane2004-10-29 22:19:53 +0000
commit23f264d125adb18b3d2eed7c4285a3549c51737c (patch)
treea4ca12bc40e53b910f64727adb98fb7c87517642
parent7d38e59448c61a09ea9399fa1c2286a5037ea439 (diff)
Rearrange order of pre-commit operations: must close cursors before doing
ON COMMIT actions. Per bug report from Michael Guerin.
-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 7a6fd3a1323..583fb36a6f6 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.192 2004/10/16 18:57:22 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.193 2004/10/29 22:19:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1438,33 +1438,25 @@ CommitTransaction(void)
Assert(s->parent == NULL);
/*
+ * 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.
*/
AfterTriggerEndXact();
- /*
- * 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();
/* close large objects before lower-level cleanup */
AtEOXact_LargeObject(true);
@@ -1476,6 +1468,15 @@ CommitTransaction(void)
/* This should be the last step before commit */
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.
*/