|
10 | 10 | *
|
11 | 11 | *
|
12 | 12 | * 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 $ |
14 | 14 | *
|
15 | 15 | *-------------------------------------------------------------------------
|
16 | 16 | */
|
@@ -2520,26 +2520,23 @@ RollbackToSavepoint(List *options)
|
2520 | 2520 |
|
2521 | 2521 | Assert(PointerIsValid(name));
|
2522 | 2522 |
|
2523 |
| - target = CurrentTransactionState; |
2524 |
| - |
2525 |
| - while (target != NULL) |
| 2523 | + for (target = s; PointerIsValid(target); target = target->parent) |
2526 | 2524 | {
|
2527 | 2525 | if (PointerIsValid(target->name) && strcmp(target->name, name) == 0)
|
2528 | 2526 | 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"))); |
2536 | 2527 | }
|
2537 | 2528 |
|
2538 | 2529 | if (!PointerIsValid(target))
|
2539 | 2530 | ereport(ERROR,
|
2540 | 2531 | (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
|
2541 | 2532 | errmsg("no such savepoint")));
|
2542 | 2533 |
|
| 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 | + |
2543 | 2540 | /*
|
2544 | 2541 | * Abort the current subtransaction, if needed. We can't Cleanup the
|
2545 | 2542 | * savepoint yet, so signal CommitTransactionCommand to do it and
|
|
0 commit comments