mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
Fix misplacement of savepointLevel test, per report from Chris K-L.
This commit is contained in:
parent
929da8e7f2
commit
a83c45c4c6
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.176 2004/08/01 20:57:59 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.177 2004/08/03 15:57:26 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2520,19 +2520,10 @@ RollbackToSavepoint(List *options)
|
|||||||
|
|
||||||
Assert(PointerIsValid(name));
|
Assert(PointerIsValid(name));
|
||||||
|
|
||||||
target = CurrentTransactionState;
|
for (target = s; PointerIsValid(target); target = target->parent)
|
||||||
|
|
||||||
while (target != NULL)
|
|
||||||
{
|
{
|
||||||
if (PointerIsValid(target->name) && strcmp(target->name, name) == 0)
|
if (PointerIsValid(target->name) && strcmp(target->name, name) == 0)
|
||||||
break;
|
break;
|
||||||
target = target->parent;
|
|
||||||
|
|
||||||
/* we don't cross savepoint level boundaries */
|
|
||||||
if (target->savepointLevel != s->savepointLevel)
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
|
|
||||||
errmsg("no such savepoint")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PointerIsValid(target))
|
if (!PointerIsValid(target))
|
||||||
@ -2540,6 +2531,12 @@ RollbackToSavepoint(List *options)
|
|||||||
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
|
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
|
||||||
errmsg("no such savepoint")));
|
errmsg("no such savepoint")));
|
||||||
|
|
||||||
|
/* disallow crossing savepoint level boundaries */
|
||||||
|
if (target->savepointLevel != s->savepointLevel)
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
|
||||||
|
errmsg("no such savepoint")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Abort the current subtransaction, if needed. We can't Cleanup the
|
* Abort the current subtransaction, if needed. We can't Cleanup the
|
||||||
* savepoint yet, so signal CommitTransactionCommand to do it and
|
* savepoint yet, so signal CommitTransactionCommand to do it and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user