summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorTom Lane2015-08-23 21:34:47 +0000
committerTom Lane2015-08-23 21:34:47 +0000
commit18391a8f0649f40bb841e6492895551fd873f79b (patch)
treeebb980f82da8763218a0a04dad04e6a592d6a083 /src/pl
parentaad663a0b4af785d0b245bbded27537f23932839 (diff)
Tweak wording of syntax error messages about bad CONTINUE/EXIT statements.
Try to avoid any possible confusion about what these messages mean.
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plpgsql/src/pl_gram.y10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
index 225c62ab36f..a1ae1bbf2cd 100644
--- a/src/pl/plpgsql/src/pl_gram.y
+++ b/src/pl/plpgsql/src/pl_gram.y
@@ -1676,11 +1676,11 @@ stmt_exit : exit_type opt_label opt_exitcond
if (label == NULL)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("label \"%s\" does not exist",
+ errmsg("there is no label \"%s\" surrounding this statement",
$2),
parser_errposition(@2)));
/* CONTINUE only allows loop labels */
- if (label->itemno != PLPGSQL_LABEL_LOOP && !$1)
+ if (label->itemno != PLPGSQL_LABEL_LOOP && !new->is_exit)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("block label \"%s\" cannot be used in CONTINUE",
@@ -1697,9 +1697,9 @@ stmt_exit : exit_type opt_label opt_exitcond
if (plpgsql_ns_find_nearest_loop(plpgsql_ns_top()) == NULL)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- /* translator: %s is EXIT or CONTINUE */
- errmsg("%s cannot be used outside a loop",
- plpgsql_stmt_typename((PLpgSQL_stmt *) new)),
+ new->is_exit ?
+ errmsg("EXIT cannot be used outside a loop, unless it has a label") :
+ errmsg("CONTINUE cannot be used outside a loop"),
parser_errposition(@1)));
}