Commit a83c45c4 authored by Tom Lane's avatar Tom Lane

Fix misplacement of savepointLevel test, per report from Chris K-L.

parent 929da8e7
...@@ -10,7 +10,7 @@ ...@@ -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,22 +2520,19 @@ RollbackToSavepoint(List *options) ...@@ -2520,22 +2520,19 @@ 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 (!PointerIsValid(target))
if (target->savepointLevel != s->savepointLevel)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION), (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
errmsg("no such savepoint"))); errmsg("no such savepoint")));
}
if (!PointerIsValid(target)) /* disallow crossing savepoint level boundaries */
if (target->savepointLevel != s->savepointLevel)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION), (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
errmsg("no such savepoint"))); errmsg("no such savepoint")));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment