Further tweak wording of error messages about bad CONTINUE/EXIT statements.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Aug 2015 18:06:13 +0000 (14:06 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Aug 2015 18:06:13 +0000 (14:06 -0400)
Per discussion, a little more verbosity seems called for.

src/pl/plpgsql/src/pl_gram.y
src/test/regress/expected/plpgsql.out

index a1ae1bbf2cded334ba9ec1cb64783cd0077e4b11..841a8d61227c03be5bcba6ce3a6c447d3c416afd 100644 (file)
@@ -1676,7 +1676,8 @@ stmt_exit     : exit_type opt_label opt_exitcond
                            if (label == NULL)
                                ereport(ERROR,
                                        (errcode(ERRCODE_SYNTAX_ERROR),
-                                        errmsg("there is no label \"%s\" surrounding this statement",
+                                        errmsg("there is no label \"%s\" "
+                                               "attached to any block or loop enclosing this statement",
                                                $2),
                                         parser_errposition(@2)));
                            /* CONTINUE only allows loop labels */
index c1822aadf0a872103c3fb3bdffdcfdec4f2d1863..83c643847d5d3aff783b9c957eb377eafa0d7811 100644 (file)
@@ -2864,7 +2864,7 @@ begin
     end;
 end;
 $$ language plpgsql;
-ERROR:  there is no label "no_such_label" surrounding this statement
+ERROR:  there is no label "no_such_label" attached to any block or loop enclosing this statement
 LINE 5:             continue no_such_label;
                              ^
 -- should fail: no such label
@@ -2877,7 +2877,7 @@ begin
     end;
 end;
 $$ language plpgsql;
-ERROR:  there is no label "no_such_label" surrounding this statement
+ERROR:  there is no label "no_such_label" attached to any block or loop enclosing this statement
 LINE 5:             exit no_such_label;
                          ^
 -- should fail: CONTINUE can't reference the label of a named block