mirror of
https://github.com/postgres/postgres.git
synced 2025-05-18 17:41:14 +03:00
Rearrange order of pre-commit operations: must close cursors before doing
ON COMMIT actions. Per bug report from Michael Guerin.
This commit is contained in:
parent
c23f808eeb
commit
61fbe85985
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* Transaction aborts can now occur two ways:
|
* Transaction aborts can now occur two ways:
|
||||||
@ -916,6 +916,11 @@ CommitTransaction(void)
|
|||||||
if (s->state != TRANS_INPROGRESS)
|
if (s->state != TRANS_INPROGRESS)
|
||||||
elog(WARNING, "CommitTransaction and not in in-progress state");
|
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
|
* Tell the trigger manager that this transaction is about to be
|
||||||
* committed. He'll invoke all trigger deferred until XACT before we
|
* committed. He'll invoke all trigger deferred until XACT before we
|
||||||
@ -923,28 +928,15 @@ CommitTransaction(void)
|
|||||||
*/
|
*/
|
||||||
DeferredTriggerEndXact();
|
DeferredTriggerEndXact();
|
||||||
|
|
||||||
|
/* Close open cursors */
|
||||||
|
AtCommit_Portals();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Similarly, let ON COMMIT management do its thing before we start to
|
* Let ON COMMIT management do its thing (must happen after closing
|
||||||
* commit.
|
* cursors, to avoid dangling-reference problems)
|
||||||
*/
|
*/
|
||||||
PreCommit_on_commit_actions();
|
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;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Do pre-commit processing (most of this stuff requires database
|
|
||||||
* access, and in fact could still cause an error...)
|
|
||||||
*/
|
|
||||||
|
|
||||||
AtCommit_Portals();
|
|
||||||
|
|
||||||
/* handle commit for large objects [ PA, 7/17/98 ] */
|
/* handle commit for large objects [ PA, 7/17/98 ] */
|
||||||
/* XXX probably this does not belong here */
|
/* XXX probably this does not belong here */
|
||||||
lo_commit(true);
|
lo_commit(true);
|
||||||
@ -955,6 +947,15 @@ CommitTransaction(void)
|
|||||||
/* Update the flat password file if we changed pg_shadow or pg_group */
|
/* Update the flat password file if we changed pg_shadow or pg_group */
|
||||||
AtEOXact_UpdatePasswordFile(true);
|
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.
|
* Here is where we really truly commit.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user