1010 *
1111 *
1212 * IDENTIFICATION
13- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.192 2004/10/16 18:57:22 tgl Exp $
13+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.193 2004/10/29 22:19:53 tgl Exp $
1414 *
1515 *-------------------------------------------------------------------------
1616 */
@@ -1437,34 +1437,26 @@ CommitTransaction(void)
14371437TransStateAsString (s -> state ));
14381438Assert (s -> parent == NULL );
14391439
1440+ /*
1441+ * Do pre-commit processing (most of this stuff requires database
1442+ * access, and in fact could still cause an error...)
1443+ */
1444+
14401445/*
14411446 * Tell the trigger manager that this transaction is about to be
14421447 * committed. He'll invoke all trigger deferred until XACT before we
14431448 * really start on committing the transaction.
14441449 */
14451450AfterTriggerEndXact ();
14461451
1447- /*
1448- * Similarly, let ON COMMIT management do its thing before we start to
1449- * commit.
1450- */
1451- PreCommit_on_commit_actions ();
1452-
1453- /* Prevent cancel/die interrupt while cleaning up */
1454- HOLD_INTERRUPTS ();
1455-
1456- /*
1457- * set the current transaction state information appropriately during
1458- * the abort processing
1459- */
1460- s -> state = TRANS_COMMIT ;
1452+ /* Close open cursors */
1453+ AtCommit_Portals ();
14611454
14621455/*
1463- *Do pre-commit processing (most of this stuff requires database
1464- *access, and in fact could still cause an error... )
1456+ *Let ON COMMIT management do its thing (must happen after closing
1457+ *cursors, to avoid dangling-reference problems )
14651458 */
1466-
1467- AtCommit_Portals ();
1459+ PreCommit_on_commit_actions ();
14681460
14691461/* close large objects before lower-level cleanup */
14701462AtEOXact_LargeObject (true);
@@ -1476,6 +1468,15 @@ CommitTransaction(void)
14761468/* This should be the last step before commit */
14771469AtEOXact_UpdatePasswordFile (true);
14781470
1471+ /* Prevent cancel/die interrupt while cleaning up */
1472+ HOLD_INTERRUPTS ();
1473+
1474+ /*
1475+ * set the current transaction state information appropriately during
1476+ * the abort processing
1477+ */
1478+ s -> state = TRANS_COMMIT ;
1479+
14791480/*
14801481 * Here is where we really truly commit.
14811482 */