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>
This commit is contained in:
Peter Eisentraut 2018-02-17 20:29:27 -05:00
parent ec87efde8d
commit 81148856b0
2 changed files with 7 additions and 7 deletions

View File

@ -3934,7 +3934,7 @@ ReleaseSavepoint(const char *name)
case TBLOCK_INPROGRESS: case TBLOCK_INPROGRESS:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION), (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
errmsg("no such savepoint"))); errmsg("savepoint \"%s\" does not exist", name)));
break; break;
case TBLOCK_IMPLICIT_INPROGRESS: case TBLOCK_IMPLICIT_INPROGRESS:
@ -3985,13 +3985,13 @@ ReleaseSavepoint(const char *name)
if (!PointerIsValid(target)) if (!PointerIsValid(target))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION), (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
errmsg("no such savepoint"))); errmsg("savepoint \"%s\" does not exist", name)));
/* disallow crossing savepoint level boundaries */ /* disallow crossing savepoint level boundaries */
if (target->savepointLevel != s->savepointLevel) 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("savepoint \"%s\" does not exist within current savepoint level", name)));
/* /*
* Mark "commit pending" all subtransactions up to the target * Mark "commit pending" all subtransactions up to the target
@ -4045,7 +4045,7 @@ RollbackToSavepoint(const char *name)
case TBLOCK_ABORT: case TBLOCK_ABORT:
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION), (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
errmsg("no such savepoint"))); errmsg("savepoint \"%s\" does not exist", name)));
break; break;
case TBLOCK_IMPLICIT_INPROGRESS: case TBLOCK_IMPLICIT_INPROGRESS:
@ -4094,13 +4094,13 @@ RollbackToSavepoint(const char *name)
if (!PointerIsValid(target)) if (!PointerIsValid(target))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_S_E_INVALID_SPECIFICATION), (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
errmsg("no such savepoint"))); errmsg("savepoint \"%s\" does not exist", name)));
/* disallow crossing savepoint level boundaries */ /* disallow crossing savepoint level boundaries */
if (target->savepointLevel != s->savepointLevel) 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("savepoint \"%s\" does not exist within current savepoint level", name)));
/* /*
* Mark "abort pending" all subtransactions up to the target * Mark "abort pending" all subtransactions up to the target

View File

@ -749,5 +749,5 @@ begin;
select 1/0; select 1/0;
ERROR: division by zero ERROR: division by zero
rollback to X; rollback to X;
ERROR: no such savepoint ERROR: savepoint "x" does not exist
-- DO NOT ADD ANYTHING HERE. -- DO NOT ADD ANYTHING HERE.