Jim Nasby <jim.na...@bluetreble.com> writes: > Calling CONTINUE with a label that's not a loop produces an error > message with no context info [1].
True. > I think err_stmt should probably only be reset in the non-return case a > bit below that. I'm not sure about err_text though. That is not going to help, as you'd soon find if you experimented: given your example, the produced error message would be ERROR: CONTINUE cannot be used outside a loop CONTEXT: PL/pgSQL function inline_code_block line 2 at statement block rather than pointing at the CONTINUE. To get where you needed to be, you'd need to have some complicated and fragile rules about where err_stmt is reset or not reset as a statement nest gets unwound. I'm inclined to think that if we wanted to make this better, the way to improve it would be to detect the error *at compile time*, and get rid of this hack in plpgsql_exec_function altogether. pl_gram.y already successfully detects cases where CONTINUE mentions a label that doesn't exist or isn't surrounding the CONTINUE. What it is missing is that we don't distinguish labels on loops from labels on non-loop statements, and thus it can't tell if CONTINUE is referencing a non-loop label or has no label but is not inside any loop-type statement. Seems like that detail could be added to the PLpgSQL_nsitem data structure without a huge amount of work. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers