Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a83c45c

Browse files
committed
Fix misplacement of savepointLevel test, per report from Chris K-L.
1 parent 929da8e commit a83c45c

File tree

1 file changed

+8
-11
lines changed
  • src/backend/access/transam

1 file changed

+8
-11
lines changed

src/backend/access/transam/xact.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.176 2004/08/01 20:57:59 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.177 2004/08/03 15:57:26 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -2520,26 +2520,23 @@ RollbackToSavepoint(List *options)
25202520

25212521
Assert(PointerIsValid(name));
25222522

2523-
target = CurrentTransactionState;
2524-
2525-
while (target != NULL)
2523+
for (target = s; PointerIsValid(target); target = target->parent)
25262524
{
25272525
if (PointerIsValid(target->name) && strcmp(target->name, name) == 0)
25282526
break;
2529-
target = target->parent;
2530-
2531-
/* we don't cross savepoint level boundaries */
2532-
if (target->savepointLevel != s->savepointLevel)
2533-
ereport(ERROR,
2534-
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
2535-
errmsg("no such savepoint")));
25362527
}
25372528

25382529
if (!PointerIsValid(target))
25392530
ereport(ERROR,
25402531
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
25412532
errmsg("no such savepoint")));
25422533

2534+
/* disallow crossing savepoint level boundaries */
2535+
if (target->savepointLevel != s->savepointLevel)
2536+
ereport(ERROR,
2537+
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
2538+
errmsg("no such savepoint")));
2539+
25432540
/*
25442541
* Abort the current subtransaction, if needed. We can't Cleanup the
25452542
* savepoint yet, so signal CommitTransactionCommand to do it and

0 commit comments

Comments
 (0)