]> granicus.if.org Git - postgresql/commitdiff
Improve savepoint error messages
authorPeter Eisentraut <peter_e@gmx.net>
Sun, 18 Feb 2018 01:29:27 +0000 (20:29 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 16 Mar 2018 17:18:06 +0000 (13:18 -0400)
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>
src/backend/access/transam/xact.c
src/test/regress/expected/transactions.out

index d16102a1e4dd22c6f2dd1c463577478596660207..499a3c6e16bad015b2a99747de21a15e0c9e7cf0 100644 (file)
@@ -3934,7 +3934,7 @@ ReleaseSavepoint(const char *name)
                case TBLOCK_INPROGRESS:
                        ereport(ERROR,
                                        (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
-                                        errmsg("no such savepoint")));
+                                        errmsg("savepoint \"%s\" does not exist", name)));
                        break;
 
                case TBLOCK_IMPLICIT_INPROGRESS:
@@ -3985,13 +3985,13 @@ ReleaseSavepoint(const char *name)
        if (!PointerIsValid(target))
                ereport(ERROR,
                                (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
-                                errmsg("no such savepoint")));
+                                errmsg("savepoint \"%s\" does not exist", name)));
 
        /* disallow crossing savepoint level boundaries */
        if (target->savepointLevel != s->savepointLevel)
                ereport(ERROR,
                                (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
@@ -4045,7 +4045,7 @@ RollbackToSavepoint(const char *name)
                case TBLOCK_ABORT:
                        ereport(ERROR,
                                        (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
-                                        errmsg("no such savepoint")));
+                                        errmsg("savepoint \"%s\" does not exist", name)));
                        break;
 
                case TBLOCK_IMPLICIT_INPROGRESS:
@@ -4094,13 +4094,13 @@ RollbackToSavepoint(const char *name)
        if (!PointerIsValid(target))
                ereport(ERROR,
                                (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
-                                errmsg("no such savepoint")));
+                                errmsg("savepoint \"%s\" does not exist", name)));
 
        /* disallow crossing savepoint level boundaries */
        if (target->savepointLevel != s->savepointLevel)
                ereport(ERROR,
                                (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
index 829a38dd5b69ba03252385b8073a4e6aa0e4e6dd..69e176c5259b74da328b1d227dd7d51cb6c78b7e 100644 (file)
@@ -749,5 +749,5 @@ begin;
 select 1/0;
 ERROR:  division by zero
 rollback to X;
-ERROR:  no such savepoint
+ERROR:  savepoint "x" does not exist
 -- DO NOT ADD ANYTHING HERE.