Skip to content

Commit 8114885

Browse files
committed
Improve savepoint error messages
Include the savepoint name in the error message and rephrase it a bit to match common style. Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
1 parent ec87efd commit 8114885

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/backend/access/transam/xact.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3934,7 +3934,7 @@ ReleaseSavepoint(const char *name)
39343934
case TBLOCK_INPROGRESS:
39353935
ereport(ERROR,
39363936
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
3937-
errmsg("no such savepoint")));
3937+
errmsg("savepoint \"%s\" does not exist", name)));
39383938
break;
39393939

39403940
case TBLOCK_IMPLICIT_INPROGRESS:
@@ -3985,13 +3985,13 @@ ReleaseSavepoint(const char *name)
39853985
if (!PointerIsValid(target))
39863986
ereport(ERROR,
39873987
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
3988-
errmsg("no such savepoint")));
3988+
errmsg("savepoint \"%s\" does not exist", name)));
39893989

39903990
/* disallow crossing savepoint level boundaries */
39913991
if (target->savepointLevel != s->savepointLevel)
39923992
ereport(ERROR,
39933993
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
3994-
errmsg("no such savepoint")));
3994+
errmsg("savepoint \"%s\" does not exist within current savepoint level", name)));
39953995

39963996
/*
39973997
* Mark "commit pending" all subtransactions up to the target
@@ -4045,7 +4045,7 @@ RollbackToSavepoint(const char *name)
40454045
case TBLOCK_ABORT:
40464046
ereport(ERROR,
40474047
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
4048-
errmsg("no such savepoint")));
4048+
errmsg("savepoint \"%s\" does not exist", name)));
40494049
break;
40504050

40514051
case TBLOCK_IMPLICIT_INPROGRESS:
@@ -4094,13 +4094,13 @@ RollbackToSavepoint(const char *name)
40944094
if (!PointerIsValid(target))
40954095
ereport(ERROR,
40964096
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
4097-
errmsg("no such savepoint")));
4097+
errmsg("savepoint \"%s\" does not exist", name)));
40984098

40994099
/* disallow crossing savepoint level boundaries */
41004100
if (target->savepointLevel != s->savepointLevel)
41014101
ereport(ERROR,
41024102
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
4103-
errmsg("no such savepoint")));
4103+
errmsg("savepoint \"%s\" does not exist within current savepoint level", name)));
41044104

41054105
/*
41064106
* Mark "abort pending" all subtransactions up to the target

src/test/regress/expected/transactions.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,5 +749,5 @@ begin;
749749
select 1/0;
750750
ERROR: division by zero
751751
rollback to X;
752-
ERROR: no such savepoint
752+
ERROR: savepoint "x" does not exist
753753
-- DO NOT ADD ANYTHING HERE.

0 commit comments

Comments
 (0)